/* Тематическая адаптация индикатора доходов для светлых тем */
body[data-theme="sunrise"] .admin-net-label,
body[data-theme="mint"] .admin-net-label {
    color: rgba(248,250,252,0.92);
}

body[data-theme="sunrise"] .admin-net-value,
body[data-theme="mint"] .admin-net-value {
    background: rgba(15,23,42,0.55);
    padding: 2px 10px;
    border-radius: 999px;
    backdrop-filter: blur(10px);
}

body[data-theme="sunrise"] .admin-net-income,
body[data-theme="mint"] .admin-net-income {
    color: #fefce8;
}

body[data-theme="sunrise"] .admin-net-in {
    color: #bbf7d0;
}

body[data-theme="sunrise"] .admin-net-out {
    color: #fed7aa;
}

body[data-theme="sunrise"] .admin-net-available {
    color: #e0f2fe;
}

body[data-theme="mint"] .admin-net-in {
    color: #a7f3d0;
}

body[data-theme="mint"] .admin-net-out {
    color: #fed7aa;
}

body[data-theme="mint"] .admin-net-available {
    color: #e0f2fe;
}

:root {
    --color-bg: #0f172a;
    --color-bg-soft: #111827;
    --color-accent: #3b82f6;
    --color-accent-soft: rgba(59, 130, 246, 0.15);
    --color-text: #e5e7eb;
    --color-muted: #9ca3af;
    --color-danger: #ef4444;
    --radius-lg: 18px;
    --radius-md: 12px;
    --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.5);
}

/* Светлая тема */
body[data-theme="light"] {
    --color-bg: #f3f4f6;
    --color-bg-soft: #ffffff;
    --color-accent: #2563eb;
    --color-accent-soft: rgba(37, 99, 235, 0.15);
    --color-text: #111827;
    --color-muted: #6b7280;
}


/* Тема Aurora (стеклянный тёмный стиль с подсветкой) */
body[data-theme="aurora"] {
    --color-bg: #050816;
    --color-bg-soft: rgba(15, 23, 42, 0.92);
    --color-accent: #ff7a1a;
    --color-accent-soft: rgba(255, 122, 26, 0.20);
    --color-text: #f9fafb;
    --color-muted: #9ca3af;

    background:
        radial-gradient(circle at top left, rgba(59,130,246,0.20), transparent 55%),
        radial-gradient(circle at bottom right, rgba(236,72,153,0.20), transparent 55%),
        #020617;
    color: var(--color-text);
}
/* Неоновая тема */
body[data-theme="neon"] {
    --color-bg: #020617;
    --color-bg-soft: #020617;
    --color-accent: #22c55e;
    --color-accent-soft: rgba(34, 197, 94, 0.18);
    --color-text: #e5e7eb;
    --color-muted: #6b7280;
}

/* Тёплая светлая тема Sunrise (оранжево-жёлтая) */
body[data-theme="sunrise"] {
    --color-bg: #fff7ed; /* тёплый кремовый */
    --color-bg-soft: rgba(255, 255, 255, 0.95);
    --color-accent: #f97316; /* яркий оранжевый */
    --color-accent-soft: rgba(249, 115, 22, 0.18);
    --color-text: #1f2937;
    --color-muted: #6b7280;

    background:
        radial-gradient(circle at 10% 0, rgba(251, 191, 36, 0.45), transparent 60%),
        radial-gradient(circle at 100% 100%, rgba(248, 113, 113, 0.40), transparent 55%),
        linear-gradient(to bottom, #fff7ed, #fef3c7);
    color: var(--color-text);
}

/* Светлая свежая тема Mint (зелёно-салатовая) */
body[data-theme="mint"] {
    --color-bg: #ecfdf3; /* мягкий мятный фон */
    --color-bg-soft: rgba(255, 255, 255, 0.96);
    --color-accent: #16a34a; /* насыщенный зелёный */
    --color-accent-soft: rgba(22, 163, 74, 0.18);
    --color-text: #052e16;
    --color-muted: #64748b;

    background:
        radial-gradient(circle at 0 0, rgba(45, 212, 191, 0.40), transparent 60%),
        radial-gradient(circle at 100% 100%, rgba(132, 204, 22, 0.40), transparent 55%),
        linear-gradient(to bottom, #ecfdf3, #e0f2fe);
    color: var(--color-text);
}

/* Обогащённые шапка и нижнее меню для светлых тем */
body[data-theme="sunrise"] .app-header,
body[data-theme="sunrise"] .app-bottom-nav {
    background: linear-gradient(to bottom, rgba(249, 115, 22, 0.98), rgba(234, 179, 8, 0.96));
    border-color: rgba(249, 115, 22, 0.65);
    box-shadow: 0 14px 35px rgba(245, 158, 11, 0.45);
}

body[data-theme="mint"] .app-header,
body[data-theme="mint"] .app-bottom-nav {
    background: linear-gradient(to bottom, rgba(34, 197, 94, 0.96), rgba(16, 185, 129, 0.94));
    border-color: rgba(34, 197, 94, 0.70);
    box-shadow: 0 14px 35px rgba(13, 148, 136, 0.45);
}

body[data-theme="sunrise"] .app-bottom-nav .nav-item-active::before,
body[data-theme="mint"] .app-bottom-nav .nav-item-active::before {
    background: radial-gradient(circle at center, rgba(255,255,255,0.95), rgba(255,255,255,0));
    opacity: 0.9;
}

body[data-theme="sunrise"] .app-bottom-nav .nav-item-active .nav-item-icon,
body[data-theme="mint"] .app-bottom-nav .nav-item-active .nav-item-icon {
    transform: translateY(-3px) scale(1.05);
}



*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, rgba(59,130,246,0.15), transparent 55%), var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

/* Оболочка приложения */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent;
    position: relative;
    overflow-x: hidden;
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to bottom, rgba(15,23,42,0.99), rgba(15,23,42,0.97));
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
    border-bottom: 1px solid rgba(148,163,184,0.35);
    z-index: 40;
}

.header-left .logo {
    font-weight: 800;
    letter-spacing: 0.14em;
    font-size: 14px;
    color: var(--color-text);
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-net-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 4px;
}

.admin-net-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(148,163,184,0.9);
    margin-bottom: 2px;
}

.admin-net-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}
.admin-net-extra {
    font-size: 12px;
    font-weight: 600;
    margin-left: 4px;
}

.admin-net-bracket,
.admin-net-sep {
    color: var(--color-text);
}

.admin-net-in {
    color: #22c55e; /* зелёный для внесений */
}

.admin-net-out {
    color: #fb923c; /* оранжевый для обязательств по выплатам */
}



.header-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.8);
    color: var(--color-text);
    text-decoration: none;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.header-icon:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.35);
    background: rgba(30, 64, 175, 0.85);
}

.notification-icon .badge {
    position: absolute;
    top: -4px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #f9fafb;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Языковое меню */

.lang-switcher {
    position: relative;
}

.lang-menu, .theme-menu {
    position: absolute;
    right: 0;
    top: 110%;
    min-width: 140px;
    padding: 6px;
    border-radius: 12px;
    background: rgba(15,23,42,0.98);
    box-shadow: 0 18px 40px rgba(0,0,0,0.6);
    backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 60;
}

.lang-switcher.open .lang-menu, .theme-switcher.open .theme-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.lang-menu a {
    display: block;
    padding: 6px 9px;
    border-radius: 8px;
    color: var(--color-text);
    font-size: 13px;
    text-decoration: none;
}

.lang-menu a:hover {
    background: rgba(55,65,81,0.8);
}

/* Основной контент */

.app-main {
    flex: 1 1 auto;
    padding: 72px 16px 120px;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
}

.screen {
    background: linear-gradient(145deg, rgba(15,23,42,0.96), rgba(17,24,39,0.96));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 16px 14px 18px;
    /* Единая ширина основного блока на всех страницах */
    max-width: 716px;
    margin: 0 auto 16px;
    border: 1px solid rgba(148,163,184,0.24);
    animation: screenIn 0.25s ease-out;
}


.screen.screen-auth {
    max-width: 420px;
    margin-top: 13vh;
    margin-bottom: 24px;
    padding: 20px 18px 22px;
}

.screen.screen-auth h1 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 18px;
}

.screen.screen-auth .form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 6px;
}

.screen.screen-auth label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.94rem;
}

.screen.screen-auth button[type="submit"] {
    width: 100%;
    margin-top: 16px;
}

.screen.screen-auth p {
    text-align: center;
    margin-top: 14px;
}

body[data-theme="light"] .screen {
    background: #ffffff;
    border-color: rgba(148,163,184,0.4);
}


body[data-theme="aurora"] .screen {
    background:
        radial-gradient(circle at top left, rgba(59,130,246,0.18), transparent 55%),
        radial-gradient(circle at bottom right, rgba(236,72,153,0.16), transparent 55%),
        #020617;
    border-color: rgba(148,163,184,0.28);
}
body[data-theme="neon"] .screen {
    background: radial-gradient(circle at top left, rgba(56,189,248,0.12), transparent 55%), #020617;
    border-color: rgba(56,189,248,0.25);
}


body[data-theme="sunrise"] .screen {
    background:
        radial-gradient(circle at top left, rgba(251,191,36,0.35), transparent 60%),
        radial-gradient(circle at bottom right, rgba(248,113,113,0.30), transparent 60%),
        rgba(255,255,255,0.96);
    border-color: rgba(251,191,36,0.55);
    box-shadow: 0 22px 50px rgba(245,158,11,0.38);
}

body[data-theme="mint"] .screen {
    background:
        radial-gradient(circle at top left, rgba(45,212,191,0.30), transparent 60%),
        radial-gradient(circle at bottom right, rgba(132,204,22,0.30), transparent 60%),
        rgba(255,255,255,0.97);
    border-color: rgba(34,197,94,0.45);
    box-shadow: 0 22px 50px rgba(13,148,136,0.36);
}

.screen h1,
.screen h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.screen p {
    margin: 4px 0;
    color: var(--color-muted);
    font-size: 14px;
}

/* Карточки */



/* Унифицированные списки карточек (жетоны, друзья, резерв и т.п.) */
.card-list,
.cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.card-list .card,
.cards-list .card {
    width: 100%;
}
.card {
    background: rgba(15,23,42,0.85);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin: 10px 0;
    border: 1px solid rgba(148,163,184,0.35);
}


body[data-theme="aurora"] .card {
    background: rgba(15,23,42,0.78);
    border-radius: 18px;
    padding: 16px 18px;
    border: 1px solid rgba(148,163,184,0.35);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(18px);
}
body[data-theme="light"] .card {
    background: #f9fafb;
}


body[data-theme="sunrise"] .card {
    background: rgba(255,255,255,0.97);
    border-radius: 20px;
    border: 1px solid rgba(251,191,36,0.55);
    box-shadow: 0 16px 40px rgba(245,158,11,0.30);
}

body[data-theme="mint"] .card {
    background: rgba(255,255,255,0.98);
    border-radius: 20px;
    border: 1px solid rgba(45,212,191,0.55);
    box-shadow: 0 16px 40px rgba(13,148,136,0.28);
}


/* Формы и кнопк

/* Notifications layout */
.card {
    overflow: hidden;
}

.notification-body {
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    word-break: break-word;
}

.notification-body img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 0.75rem;
    margin: 6px 0;
}
и */

.form,
.form-inline {
    margin-top: 10px;
}

.form-inline {
    display: flex;
    gap: 8px;
}

.form label {
    display: block;
    font-size: 13px;
    color: var(--color-muted);
    margin-bottom: 6px;
}



/* Поле выбора даты (дата рождения и т.п.) в стиле остальных инпутов */
input[type="date"] {
    width: 100%;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.5);
    padding: 8px 12px;
    background: rgba(15,23,42,0.8);
    color: var(--color-text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    -webkit-appearance: none;
}

body[data-theme="light"] input[type="date"] {
    background: #ffffff;
}

/* Акцент при фокусе */
input[type="date"]:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px rgba(59,130,246,0.4);
    background: rgba(15,23,42,0.95);
}

/* Иконка календаря под тёмную тему (WebKit-браузеры) */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(80%);
    cursor: pointer;
}

/* Убираем жёсткий внутренний фон в Chrome */
input[type="date"]::-webkit-datetime-edit {
    color: inherit;
    padding: 0;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="tel"] {
    width: 100%;
    box-sizing: border-box;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.5);
    padding: 8px 12px;
    min-height: 34px;
    line-height: 1.2;
    background: rgba(15,23,42,0.8);
    color: var(--color-text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
 ease, background 0.15s ease;
}

body[data-theme="light"] input[type="text"],
body[data-theme="light"] input[type="password"],
body[data-theme="light"] input[type="number"],
body[data-theme="light"] input[type="tel"] {
    background: #ffffff;
}


body[data-theme="sunrise"] input[type="text"],
body[data-theme="sunrise"] input[type="password"],
body[data-theme="sunrise"] input[type="number"],
body[data-theme="sunrise"] input[type="tel"] {
    background: rgba(255,255,255,0.96);
    border-color: rgba(249,115,22,0.55);
    color: #7c2d12;
    box-shadow: 0 10px 24px rgba(245,158,11,0.25);
}

body[data-theme="mint"] input[type="text"],
body[data-theme="mint"] input[type="password"],
body[data-theme="mint"] input[type="number"],
body[data-theme="mint"] input[type="tel"] {
    background: rgba(255,255,255,0.97);
    border-color: rgba(34,197,94,0.55);
    color: #064e3b;
    box-shadow: 0 10px 24px rgba(16,185,129,0.22);
}

input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px rgba(59,130,246,0.5);
}


body[data-theme="sunrise"] input:focus {
    border-color: rgba(249,115,22,0.95);
    box-shadow: 0 0 0 1px rgba(249,115,22,0.55);
}

body[data-theme="mint"] input:focus {
    border-color: rgba(34,197,94,0.95);
    box-shadow: 0 0 0 1px rgba(16,185,129,0.55);
}

.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, opacity 0.12s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(to right, var(--color-accent), #60a5fa);
    color: #f9fafb;
    box-shadow: 0 12px 30px rgba(37,99,235,0.6);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 40px rgba(37,99,235,0.7);
}

.btn-secondary {
    background: rgba(31,41,55,0.9);
    color: var(--color-text);
}

.btn-secondary:hover {
    background: rgba(55,65,81,0.95);
}

.btn-danger {
    background: #b91c1c;
    color: #fee2e2;
}

.btn-danger:hover {
    background: #dc2626;
}


/* Светлая тема: повышенная контрастность кнопок и админ-навигации */

body[data-theme="light"] .btn-primary {
    background: linear-gradient(to right, #2563eb, #3b82f6);
    color: #f9fafb;
    box-shadow: 0 10px 22px rgba(37,99,235,0.35);
}

body[data-theme="light"] .btn-secondary {
    background: #e5e7eb;
    color: #111827;
    border: 1px solid #cbd5e1;
    box-shadow: none;
}

body[data-theme="light"] .btn-secondary:hover {
    background: #dbe2eb;
}

body[data-theme="light"] .btn-danger {
    background: #b91c1c;
    color: #fee2e2;
}

/* Админ-навигация в светлой теме */

body[data-theme="light"] .admin-nav-link {
    background: #e5e7eb;
    color: #111827;
    border-color: rgba(148,163,184,0.9);
}

body[data-theme="light"] .admin-nav-link:hover {
    background: #dbe2eb;
}

body[data-theme="light"] .admin-nav-active {
    background: var(--color-accent);
    border-color: rgba(37,99,235,0.8);
    color: #0b1120;
}



/* Темы Sunrise и Mint: кнопки и админ-навигация */

body[data-theme="sunrise"] .btn-primary {
    background: linear-gradient(to right, #f97316, #fbbf24);
    color: #1f2937;
    box-shadow: 0 12px 26px rgba(248, 163, 25, 0.55);
}

body[data-theme="sunrise"] .btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #92400e;
    border: 1px solid rgba(249, 115, 22, 0.45);
    box-shadow: none;
}

body[data-theme="mint"] .btn-primary {
    background: linear-gradient(to right, #22c55e, #14b8a6);
    color: #ecfdf3;
    box-shadow: 0 12px 26px rgba(16, 185, 129, 0.55);
}

body[data-theme="mint"] .btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #064e3b;
    border: 1px solid rgba(34, 197, 94, 0.45);
    box-shadow: none;
}

/* Админ-навигация для Sunrise и Mint */

body[data-theme="sunrise"] .admin-nav-link {
    background: rgba(255,255,255,0.75);
    color: #7c2d12;
    border-color: rgba(251,191,36,0.95);
    box-shadow: 0 10px 26px rgba(180, 83, 9, 0.55);
}

body[data-theme="sunrise"] .admin-nav-active {
    background: rgba(251,191,36,0.96);
    border-color: rgba(245,158,11,0.95);
    color: #1f2933;
}

body[data-theme="mint"] .admin-nav-link {
    background: rgba(255,255,255,0.80);
    color: #064e3b;
    border-color: rgba(34,197,94,0.95);
    box-shadow: 0 10px 26px rgba(15,118,110,0.40);
}

body[data-theme="mint"] .admin-nav-active {
    background: rgba(34,197,94,0.96);
    border-color: rgba(16,185,129,0.95);
    color: #022c22;
}

/* Выпадающие меню языка/темы в светлой теме */

body[data-theme="light"] .lang-menu,
body[data-theme="light"] .theme-menu {
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(148,163,184,0.45);
    box-shadow: 0 18px 40px rgba(15,23,42,0.16);
}

body[data-theme="light"] .lang-menu a {
    color: #111827;
}
.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
    transform: translateY(1px);
    box-shadow: none;
    opacity: 0.9;
}

/* Сообщения */

.success {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(22,163,74,0.12);
    color: #bbf7d0;
    font-size: 13px;
}

.error {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(239,68,68,0.12);
    color: #fecaca;
    font-size: 13px;
}

/* Таблицы */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 8px;
}

.table th,
.table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(55,65,81,0.6);
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
}

.table th {
    font-weight: 600;
    color: var(--color-muted);
}

/* Нижняя навигация */

.app-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 60px;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    background: linear-gradient(to top, rgba(15,23,42,0.99), rgba(15,23,42,0.97));
    backdrop-filter: blur(14px);
    box-shadow: 0 -10px 25px rgba(0,0,0,0.7);
    border-top: 1px solid rgba(15,23,42,0.9);
    z-index: 45;
}

.nav-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 11px;
    color: var(--color-muted);
    text-decoration: none;
}

.nav-item-icon {
    font-size: 18px;
}

.nav-item-label {
    font-size: 11px;
}

/* Плавающая кнопка установки PWA */

.install-app-btn {
    position: fixed;
    right: 12px;
    bottom: 76px;
    padding: 8px 12px;
    border-radius: 999px;
    border: none;
    background: var(--color-accent, #3b82f6);
    color: #ffffff;
    font-size: 12px;
    box-shadow: 0 10px 20px rgba(15,23,42,0.4);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 60;
}

.install-app-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Эффекты */

.effect-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 100;
}

.effect-particle {
    position: absolute;
    top: -10%;
    animation-name: effect-fall;
    animation-timing-function: linear;
    animation-iteration-count: 1;
    will-change: transform, opacity;
}

@keyframes effect-fall {
    0% {
        transform: translate3d(0, -10%, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--drift-x, 20px), 110vh, 0) rotate(360deg);
        opacity: 0;
    }
}

@keyframes effect-fall-no-rotate {
    0% {
        transform: translate3d(0, -10%, 0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--drift-x, 20px), 110vh, 0);
        opacity: 0;
    }
}

/* Админ-панель */

.admin-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.admin-nav a {
    flex: 1 1 auto;
    min-width: 90px;
    text-align: center;
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(15,23,42,0.9);
    color: var(--color-text);
    font-size: 12px;
    text-decoration: none;
}

.admin-nav a:hover {
    background: rgba(255,255,255,0.10);
}


/* Hover-состоитния для админ-навигации в темах Sunrise и Mint */
body[data-theme="sunrise"] .admin-nav-link:hover {
    background: rgba(251,191,36,0.24);
    color: #7c2d12;
}

body[data-theme="mint"] .admin-nav-link:hover {
    background: rgba(45,212,191,0.20);
    color: #022c22;
}

/* Анимации */

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

/* Небольшой твик под большие экраны */
@media (min-width: 768px) {
    .app-main {
        padding-top: 72px;
        padding-bottom: 84px;
    }
}


.app-bottom-nav .nav-item {
    position: relative;
    padding-top: 6px;
    padding-bottom: 6px;
}

.nav-item-active {
    color: var(--color-accent);
}

.nav-item-active .nav-item-icon {
    transform: translateY(-1px) scale(1.05);
}

.nav-item-active .nav-item-label {
    font-weight: 700;
}


/* Тематическая раскраска нижней навигации для Sunrise и Mint */

body[data-theme="sunrise"] .app-bottom-nav .nav-item {
    color: rgba(255,255,255,0.92);
    text-shadow: 0 0 6px rgba(0,0,0,0.35);
    font-weight: 500;
}

body[data-theme="sunrise"] .app-bottom-nav .nav-item-active {
    color: #7c2d12;
    text-shadow: none;
}

body[data-theme="mint"] .app-bottom-nav .nav-item {
    color: rgba(241,245,249,0.95);
    text-shadow: 0 0 6px rgba(0,0,0,0.35);
    font-weight: 500;
}

body[data-theme="mint"] .app-bottom-nav .nav-item-active {
    color: #022c22;
    text-shadow: none;
}

/* Подсветка активного пункта нижней навигации */
.app-bottom-nav .nav-item-active::before {
    content: '';
    position: absolute;
    inset: 6px 18%;
    border-radius: 999px;
    background: rgba(59,130,246,0.18);
    box-shadow: 0 0 0 1px rgba(59,130,246,0.55);
    z-index: -1;
}


.theme-menu button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 2px;
    border-radius: 999px;
    border: none;
    background: rgba(31,41,55,0.9);
    color: #f9fafb;
    cursor: pointer;
    font-size: 14px;
}
.theme-menu button:hover {
    background: rgba(59,130,246,0.9);
}


.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.admin-nav-link {
    flex: 1 1 auto;
    min-width: 90px;
    text-align: center;
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(15,23,42,0.9);
    color: var(--color-text);
    font-size: 12px;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.admin-nav-link:hover {
    background: rgba(37,99,235,0.85);
    transform: translateY(-1px);
}

.admin-nav-active {
    background: var(--color-accent);
    border-color: rgba(191,219,254,0.9);
    color: #0b1120;
    box-shadow: 0 10px 25px rgba(37,99,235,0.6);
}


.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.cards .card h3 {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 15px;
}

.cards .card p {
    margin: 2px 0;
    font-size: 13px;
}


.badge-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
}

.badge-status-pending {
    background: rgba(234,179,8,0.18);
    color: #facc15;
}

.badge-status-approved {
    background: rgba(22,163,74,0.18);
    color: #4ade80;
}

.badge-status-rejected {
    background: rgba(239,68,68,0.18);
    color: #fca5a5;
}


.table tr:hover {
    background: rgba(15,23,42,0.6);
}


.dropzone {
    margin-top: 8px;
    padding: 16px;
    border-radius: 16px;
    border: 1px dashed rgba(148,163,184,0.8);
    text-align: center;
    font-size: 13px;
    cursor: pointer;
    background: rgba(15,23,42,0.6);
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
    position: relative;
}
.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.dropzone:hover {
    border-color: rgba(96,165,250,0.9);
    background: rgba(15,23,42,0.9);
    transform: translateY(-1px);
}
.dropzone.dragover {
    border-color: rgba(56,189,248,1);
    background: rgba(15,23,42,1);
}

.content-image-preview img {
    max-width: 180px;
    max-height: 100px;
    object-fit: contain;
    border-radius: 16px;
    border: 1px solid rgba(148,163,184,0.6);
    background: rgba(15,23,42,0.8);
}

.logo-preview img {
    max-width: 160px;
    max-height: 80px;
    object-fit: contain;
}

.icon-preview {
    max-width: 80px;
    max-height: 80px;
    object-fit: contain;
    border-radius: 16px;
    border: 1px solid rgba(148,163,184,0.6);
    background: rgba(15,23,42,0.8);
    display: inline-block;
}

.logo-image img {
    max-height: 28px;
    max-width: 140px;
    object-fit: contain;
}


.token-icon-preview img {
    max-width: 48px;
    max-height: 48px;
    object-fit: contain;
}


@keyframes cardFadeIn {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: cardFadeIn 0.25s ease-out;
}


.icon-svg {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
}
.theme-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
}
.app-bottom-nav .nav-item-icon img {
    width: 22px;
    height: 22px;
}


.nav-item {
    transition: color 0.15s ease-out, background 0.15s ease-out;
}

.nav-item-icon {
    transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}


.token-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.token-image-wrap {
    width: calc(64px * var(--token-image-scale, 1));
    height: calc(64px * var(--token-image-scale, 1));
    border-radius: 18px;
    background: rgba(15,23,42,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}


body[data-theme="sunrise"] .token-image-wrap {
    background: radial-gradient(circle at 30% 0, rgba(251,191,36,0.70), rgba(249,115,22,0.85));
    box-shadow: 0 12px 28px rgba(245,158,11,0.45);
}

body[data-theme="mint"] .token-image-wrap {
    background: radial-gradient(circle at 30% 0, rgba(45,212,191,0.75), rgba(16,185,129,0.90));
    box-shadow: 0 12px 28px rgba(13,148,136,0.45);
}

.token-image-wrap img {
    max-width: calc(52px * var(--token-image-scale, 1));
    max-height: calc(52px * var(--token-image-scale, 1));
    object-fit: contain;
}

/* Переходы между экранами в духе мобильных приложений */
.app-main {
    position: relative;
    will-change: transform, opacity;
    transition: transform 0.18s ease-out, opacity 0.18s ease-out;
}

.app-main.screen-slide-out {
    transform: translateX(-12px);
    opacity: 0.4;
}

.friend-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friend-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, rgba(96,165,250,1), rgba(15,23,42,1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.friend-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.friend-name {
    font-size: 15px;
    font-weight: 600;
}

.friend-sub {
    font-size: 12px;
    opacity: 0.7;
}

.friend-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.5);
}

.friend-status.online {
    border-color: rgba(52,211,153,0.9);
    color: rgba(52,211,153,1);
}

.friend-status.offline {
    opacity: 0.7;
}

.friend-footer {
    font-size: 11px;
    opacity: 0.7;
}

.rating-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
}

.rating-actions {
    margin-top: 8px;
    font-size: 12px;
}

.chip {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.6);
    text-decoration: none;
    font-size: 12px;
}

.chip-active {
    background: radial-gradient(circle at 10% 0, rgba(56,189,248,0.9), rgba(15,23,42,1));
    border-color: transparent;
}

.rating-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rating-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rating-rank {
    font-weight: 700;
    font-size: 16px;
}

.rating-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rating-name {
    font-size: 14px;
    font-weight: 600;
}

.rating-id {
    font-size: 11px;
    opacity: 0.7;
}

.rating-sub {
    font-size: 12px;
    opacity: 0.7;
}

.rating-badge {
    min-width: 72px;
    text-align: right;
    font-size: 11px;
}

.rating-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.rating-label {
    opacity: 0.7;
}

.rating-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    opacity: 0.8;
}

.profile-header-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-header-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-avatar-wrap {
    position: relative;
    width: 64px;
    height: 64px;
}

.avatar-circle {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    border: 3px solid rgba(148,163,184,0.8);
    background: radial-gradient(circle at 30% 30%, rgba(148,163,184,0.9), rgba(15,23,42,1));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-circle span {
    font-size: 24px;
    font-weight: 600;
}

.avatar-level {
    position: absolute;
    right: -4px;
    top: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(15,23,42,0.95);
    border: 2px solid rgba(148,163,184,0.9);
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-header-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-name {
    font-size: 16px;
    font-weight: 600;
}

.profile-sub {
    font-size: 12px;
    opacity: 0.8;
}

.avatar-form {
    margin-top: 8px;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-invite,
.profile-invite-link {
    font-size: 12px;
    opacity: 0.85;
}

/* Друзья: используем те же аватарки, только меньше */
.friend-avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
}

.friend-avatar .avatar-circle {
    border-width: 2px;
}

.friend-avatar .avatar-circle span {
    font-size: 16px;
}

.friend-avatar .avatar-level {
    min-width: 14px;
    height: 14px;
    font-size: 9px;
    border-width: 1px;
}

.avatar-form {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.avatar-dropzone {
    border-radius: 16px;
    border: 1px dashed rgba(148,163,184,0.7);
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
}

.avatar-dropzone p {
    font-size: 12px;
    opacity: 0.8;
    margin: 0;
    min-width: 80px;
}

.avatar-dropzone input[type="file"] {
    display: none;
}

.avatar-preview {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    overflow: hidden;
    border: 2px solid rgba(148,163,184,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 30%, rgba(148,163,184,0.9), rgba(15,23,42,1));
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-preview span {
    font-size: 18px;
    font-weight: 600;
}

.avatar-dropzone::after {
    content: '↕';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.3;
}

.admin-avatar-wrap {
    position: relative;
    width: 32px;
    height: 32px;
}

.admin-avatar-wrap .avatar-circle {
    width: 32px;
    height: 32px;
    border-width: 2px;
}

.admin-avatar-wrap .avatar-circle span {
    font-size: 14px;
}

.admin-avatar-wrap .avatar-level {
    min-width: 14px;
    height: 14px;
    font-size: 9px;
}

/* Микровзаимодействия и плавные hover-эффекты */
button,
.btn-primary,
.btn-secondary {
    transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, background 0.12s ease-out;
}

button:active,
.btn-primary:active,
.btn-secondary:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 0 0 rgba(0,0,0,0);
}

.card {
    transition: transform 0.14s ease-out, box-shadow 0.14s ease-out, border-color 0.14s ease-out;
}

.card:hover {
    transform: translateY(-1px);
}

.app-bottom-nav .nav-item-icon img {
    transition: transform 0.12s ease-out, opacity 0.12s ease-out;
}

.nav-item:active .nav-item-icon img {
    transform: scale(0.9);
    opacity: 0.8;
}


.profile-invite-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.profile-invite-link-text {
    font-weight: 600;
    word-break: break-all;
}

.btn-copy-link {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
}

.copy-link-status {
    font-size: 11px;
    color: #22c55e;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.copy-link-status.is-visible {
    opacity: 1;
}

/* --- Token payment screen (TRC20) --- */
.token-payment-head {
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.token-payment-title{font-weight:700;font-size:16px;line-height:1.2}
.token-payment-sub{opacity:.8;font-size:13px}
.token-payment-status{margin:6px 0 14px 0}
.token-payment-status-sub{opacity:.8;font-size:12px;margin-top:4px;word-break:break-all}
.token-payment-grid{display:flex;flex-direction:column;gap:12px}
.token-payment-row{display:flex;flex-direction:column;gap:6px}
.token-payment-k{font-size:12px;opacity:.85}
.token-payment-v{font-size:14px}
.token-payment-hint{opacity:.85;font-size:12px;margin-top:6px}
.token-payment-hint.warn{opacity:1}
.token-payment-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.token-payment-footnote{opacity:.75;font-size:12px;margin-top:12px}
.token-payment-alert{margin:10px 0 14px 0;padding:10px 12px;border-radius:14px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.06)}
.token-payment-alert-title{font-weight:700;font-size:13px;margin-bottom:6px}
.token-payment-alert-body{font-size:12px;opacity:.9;line-height:1.35}
.token-payment-alert-body.warn{opacity:1}
.token-payment-alert-metrics{margin-top:8px;font-size:12px;opacity:.85;word-break:break-word}

/* Яркое предупреждение о дедлайне оплаты */
.token-payment-deadline{margin:12px 0 14px 0;padding:12px 14px;border-radius:16px;border:1px solid rgba(255,255,255,.18);background:linear-gradient(135deg, rgba(255,82,82,.35), rgba(255,152,0,.28));box-shadow:0 10px 24px rgba(0,0,0,.18)}
.token-payment-deadline-title{font-weight:800;font-size:14px;margin-bottom:6px;letter-spacing:.2px}
.token-payment-deadline-body{font-size:12.5px;line-height:1.35;opacity:.96}
.token-payment-deadline-timer{display:inline-block;padding:2px 8px;border-radius:999px;background:rgba(0,0,0,.22);font-weight:800;font-variant-numeric:tabular-nums;margin:0 4px}
.token-payment-deadline.is-expired{background:rgba(239,68,68,.18);border-color:rgba(239,68,68,.35)}

.token-payment-req-list{display:flex;flex-direction:column;gap:10px;margin-top:10px}
.token-payment-req-item{display:flex;justify-content:space-between;gap:10px;padding:12px 12px;border-radius:16px;border:1px solid rgba(255,255,255,.10);background:rgba(255,255,255,.04);text-decoration:none;color:inherit}
.token-payment-req-item.active{border-color:rgba(0,200,255,.35);box-shadow:0 0 0 1px rgba(0,200,255,.25) inset}
.token-payment-req-title{font-weight:700;font-size:13px;line-height:1.2}
.token-payment-req-sub{opacity:.75;font-size:12px;margin-top:4px}
.token-payment-req-right{text-align:right;min-width:120px}
.token-payment-req-status{font-size:12px;font-weight:700}
.token-payment-req-amt{opacity:.75;font-size:12px;margin-top:4px;word-break:break-word}

.copy-link-status.is-error {
    color: #ef4444;
}


.vertical-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.vertical-form label span {
    display: block;
    font-size: 13px;
    color: var(--color-muted);
    margin-bottom: 3px;
}

.vertical-form input[type="password"] {
    width: 100%;
}



.profile-logout-row {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.profile-logout-btn {
    font-size: 12px;
}



/* Админ-раздел: база данных */
.db-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.db-column h2 {
    margin-top: 0;
    margin-bottom: 4px;
}

.db-column p {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 13px;
    opacity: 0.9;
}

.db-reset-card {
    border: 1px solid rgba(248,113,113,0.55);
    background: linear-gradient(135deg, rgba(248,250,252,0.98), rgba(254,242,242,0.96));
}

.danger-text {
    color: #b91c1c;
}

.checkbox-field {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    margin: 8px 0 12px;
}

.checkbox-field input[type="checkbox"] {
    margin-top: 2px;
}

.form-hint {
    font-size: 12px;
    opacity: 0.8;
}




.db-self-destruct-card {
    border-color: rgba(239,68,68,0.85);
    background: linear-gradient(135deg, rgba(254,242,242,0.98), rgba(254,202,202,0.98));
}

.btn-danger-strong {
    background: linear-gradient(135deg, #b91c1c, #ef4444);
    color: #fee2e2;
    box-shadow: 0 0 0 1px rgba(127,29,29,0.85), 0 14px 32px rgba(248,113,113,0.75);
}
.profile-invite-link {
    margin-top: 8px;
}

.profile-invite-label {
    display: block;
    font-size: 12px;
    color: var(--color-muted, #9ca3af);
    margin-bottom: 4px;
}

.profile-invite-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.profile-invite-link-input {
    flex: 1 1 auto;
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.5);
    color: inherit;
    outline: none;
}

body[data-theme="light"] .profile-invite-link-input {
    background: #ffffff;
    border-color: #d1d5db;
    color: #111827;
}



/* Импорт базы данных: стилизованное поле выбора файла */
.file-upload-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
}

.file-upload-field span {
    opacity: 0.8;
}

.file-upload-input {
    position: relative;
    display: block;
    width: 100%;
    max-width: 280px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.5);
    padding: 8px 12px;
    background: rgba(15,23,42,0.9);
    color: var(--color-text);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.file-upload-input:hover {
    border-color: var(--color-accent);
    background: rgba(15,23,42,1);
}

.file-upload-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px rgba(59,130,246,0.4);
}

/* Прячем слишком яркий системный текст */
.file-upload-input::file-selector-button {
    margin-right: 8px;
    border: none;
    border-radius: 999px;
    padding: 6px 10px;
    background: var(--color-accent);
    color: #0b1220;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.file-upload-input::file-selector-button:hover {
    filter: brightness(1.1);
}


.token-card {
    padding: 12px 12px;
}

.token-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.token-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.token-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.token-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.token-actions .form-inline {
    width: 100%;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.token-actions .form-inline label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.token-actions .form-inline input[type="number"] {
    max-width: 90px;
}

.token-actions .btn-primary {
    white-space: nowrap;
}


/* Safe area support for devices with notch / home indicator (iOS, etc.) */
@supports(padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .app-main {
        padding-top: calc(72px + env(safe-area-inset-top));
        padding-bottom: calc(120px + env(safe-area-inset-bottom));
    }

    .app-header {
        height: calc(56px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
        top: 0;
    }

    .app-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(60px + env(safe-area-inset-bottom));
        bottom: 0;
    }
}


/* Горизонтальный скролл для широких таблиц в админке */
.table-scroll-x {
    width: 100%;
    overflow-x: auto;
}


/* Большая кнопка получения дохода в профиле */
.card.card-income-highlight {
    margin-top: 12px;
    margin-bottom: 4px;
    padding: 16px 18px;
    text-align: center;
}

.btn-income-large {
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
}


/* Таблица настроек визуальных эффектов */
.table-wrapper-horizontal {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
}

.admin-effects-table {
    min-width: 1120px;
}

.admin-effects-table th,
.admin-effects-table td {
    white-space: nowrap;
}

.admin-effects-table th:nth-child(5),
.admin-effects-table th:nth-child(6),
.admin-effects-table th:nth-child(7),
.admin-effects-table th:nth-child(8),
.admin-effects-table th:nth-child(9),
.admin-effects-table td:nth-child(5),
.admin-effects-table td:nth-child(6),
.admin-effects-table td:nth-child(7),
.admin-effects-table td:nth-child(8),
.admin-effects-table td:nth-child(9) {
    text-align: center;
}

.admin-effects-table .dropzone {
    padding: 6px 8px;
    min-width: 200px;
    max-width: 230px;
    font-size: 11px;
}

.admin-effects-table .dropzone p {
    margin: 0 0 4px;
}

.admin-effects-table .dropzone-preview {
    max-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-effects-table .dropzone-preview img {
    max-width: 100%;
    max-height: 40px;
    display: block;
}

.admin-effects-table .dropzone {
    white-space: normal;
    font-size: 10px;
    line-height: 1.3;
}


.admin-net-income {
    color: #22c55e; /* зелёный: доход системы */
}

.admin-net-in {
    color: #fb923c; /* оранжевый: внесено */
}

.admin-net-out {
    color: #facc15; /* жёлтый: выведено */
}

.admin-net-available {
    color: #ef4444; /* красный: на руках у пользователей */
    margin-left: 6px;
}


/* Блок ссылок установки приложения */
.install-links {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    font-size: 13px;
}

.install-links-title {
    margin-bottom: 6px;
    opacity: 0.9;
}

.install-links-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-install {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: rgba(15, 23, 42, 0.88);
    color: #e5e7eb;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.80);
    letter-spacing: 0.01em;
}

.btn-install:hover {
    text-decoration: none;
    background: rgba(30, 64, 175, 0.95);
    border-color: rgba(129, 140, 248, 0.95);
}

.btn-install.ios::before {
    content: "";
    font-size: 15px;
    line-height: 1;
}

.btn-install.android::before {
    content: "🤖";
    font-size: 15px;
    line-height: 1;
}

/* Светлые темы: более лёгкий стиль кнопок установки */
body[data-theme="light"] .btn-install,
body[data-theme="sunrise"] .btn-install,
body[data-theme="mint"] .btn-install {
    background: rgba(255,255,255,0.96);
    color: #111827;
    border-color: rgba(148, 163, 184, 0.50);
    box-shadow: 0 12px 28px rgba(148, 163, 184, 0.35);
}

body[data-theme="light"] .btn-install:hover,
body[data-theme="sunrise"] .btn-install:hover,
body[data-theme="mint"] .btn-install:hover {
    background: rgba(239, 246, 255, 0.98);
    border-color: rgba(37, 99, 235, 0.75);
}


/* Мобильный отклик по касанию */
.tapable,
.tapable-card {
    -webkit-tap-highlight-color: transparent;
}

.btn-primary.tapable,
.btn-secondary.tapable,
.btn-danger.tapable {
    transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, background 0.12s ease-out, opacity 0.12s ease-out;
}

.btn-primary.tapable.is-touched {
    transform: scale(0.96) translateY(0);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.85);
    background: linear-gradient(to right, #ff8a3a, #60a5fa);
    color: #ffffff;
    opacity: 0.98;
}

.btn-secondary.tapable.is-touched {
    transform: scale(0.96) translateY(0);
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.8);
    background: rgba(55,65,81,0.98);
    color: #f9fafb;
    opacity: 0.98;
}

.btn-danger.tapable.is-touched {
    transform: scale(0.96) translateY(0);
    box-shadow: 0 8px 26px rgba(127, 29, 29, 0.8);
    background: #dc2626;
    color: #fee2e2;
    opacity: 0.98;
}

.tapable-card.is-touched {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.60);
}


/* Ripple-эффект для основных кнопок */
.btn-primary.tapable {
    position: relative;
    overflow: hidden;
}

.tap-ripple {
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
    transform: scale(0);
    opacity: 0.4;
    animation: tap-ripple 0.35s ease-out forwards;
}

@keyframes tap-ripple {
    to {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Page builder basic styles */
.page-block {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-radius: 0.9rem;
  background: rgba(15,23,42,0.7);
  box-shadow: 0 12px 25px rgba(15,23,42,0.45);
}

/* Drag-and-drop area for images in page builder */
.pb-dropzone {
  margin-top: 0.35rem;
  padding: 0.5rem;
  border-radius: 0.75rem;
  border: 1px dashed rgba(148,163,184,0.85);
  font-size: 0.8rem;
  text-align: center;
  cursor: pointer;
  background: rgba(15,23,42,0.4);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pb-dropzone.is-dragover {
  border-style: solid;
  border-color: rgba(96,165,250,0.95);
  background: rgba(37,99,235,0.18);
}

.pb-image-wrapper {
  margin: 0.5rem 0;
  text-align: center;
}

.pb-image-wrapper img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.pb-btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
}

.pb-btn-big {
  font-size: 1rem;
}

.pb-btn-small {
  font-size: 0.85rem;
  padding: 0.35rem 0.9rem;
}

.pb-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.12);
  margin: 0.75rem 0;
}

.pb-spacer {
  height: 1rem;
}

/* text formatting */
.pb-bold {
  font-weight: 700;
}

.pb-italic {
  font-style: italic;
}

.pb-underline {
  text-decoration: underline;
}

/* text colors */
.pb-color-red    { color: #ff4b4b; }
.pb-color-orange { color: #ffa94b; }
.pb-color-yellow { color: #ffd43b; }
.pb-color-green  { color: #40c057; }
.pb-color-blue   { color: #4dabf7; }
.pb-color-indigo { color: #5c7cfa; }
.pb-color-violet { color: #cc5de8; }
.pb-color-black  { color: #000000; }
.pb-color-white  { color: #ffffff; }
.pb-color-pink   { color: #ff6bcb; }


/* Списки элементов конструктора страниц */
.simple-list {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.simple-list li {
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(15,23,42,0.85);
    border: 1px solid rgba(148,163,184,0.35);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

body[data-theme="light"] .simple-list li {
    background: #f9fafb;
}

/* Детали редактирования элемента */
.pb-edit-details {
    border-radius: 10px;
    border: 1px dashed rgba(148,163,184,0.45);
    padding: 6px 8px;
    background: rgba(15,23,42,0.65);
}

.pb-edit-details[open] {
    background: rgba(15,23,42,0.9);
}

.pb-edit-details summary {
    list-style: none;
}

.pb-edit-details summary::-webkit-details-marker {
    display: none;
}

/* Формы внутри конструктора */
.pb-edit-details form,
.pb-add-form {
    margin-top: 6px;
}

.pb-edit-details label,
.pb-add-form label {
    display: block;
    font-size: 12px;
    color: var(--color-muted);
    margin-bottom: 6px;
}

.pb-edit-details textarea,
.pb-add-form textarea {
    min-height: 40px;
}

.pb-edit-details fieldset,
.pb-add-form fieldset {
    border: 1px solid rgba(148,163,184,0.35);
    border-radius: 10px;
    padding: 6px 8px;
}

.pb-edit-details legend,
.pb-add-form legend {
    font-size: 11px;
    color: var(--color-muted);
    padding: 0 4px;
}


/* Drag-and-drop для конструктора страниц */
.drag-handle {
    cursor: grab;
    user-select: none;
    font-size: 14px;
    margin-right: 6px;
    opacity: 0.7;
}
.drag-handle:active {
    cursor: grabbing;
    opacity: 1;
}
.js-block-item.is-dragging {
    opacity: 0.5;
}



/* Header: back button + logo */
.header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-back {
    border: none;
    background: transparent;
    padding: 4px 6px;
    margin-right: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    color: var(--color-text-muted);
    border-radius: 999px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.header-back:active {
    transform: translateX(-1px);
    opacity: 0.85;
}

.header-back-icon {
    display: block;
}


/* Floating notices under header */
.floating-notice {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    z-index: 60;
    max-width: 480px;
    width: calc(100% - 24px);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0,0,0,0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.floating-notice-success {
    background: rgba(187, 247, 208, 0.98);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.floating-notice-error {
    background: rgba(254, 226, 226, 0.98);
    color: #991b1b;
    border: 1px solid rgba(248, 113, 113, 0.6);
}

.floating-notice-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(8px);
}


/* 

/* Page transition animations with configurable duration & distance */
:root {
    --page-anim-duration: 0.32s;
    --page-anim-distance: 12px;
    --card-anim-duration: 0.35s;
    --card-anim-distance: 10px;
}

.app-main {
    will-change: transform, opacity;
}

.page-transition-slide-left {
    animation: page-slide-left var(--page-anim-duration) ease-out forwards;
}

.page-transition-slide-right {
    animation: page-slide-right var(--page-anim-duration) ease-out forwards;
}

.page-transition-fade {
    animation: page-fade var(--page-anim-duration) ease-out forwards;
}

.page-transition-zoom-in {
    animation: page-zoom-in var(--page-anim-duration) ease-out forwards;
}

/* Для внутренних страниц как "sheet" (снизу вверх) */
.page-transition-sheet-up {
    animation: page-sheet-up var(--page-anim-duration) ease-out forwards;
}

.page-transition-sheet-down {
    animation: page-sheet-down var(--page-anim-duration) ease-out forwards;
}

@keyframes page-slide-left {
    from {
        opacity: 0;
        transform: translateX(var(--page-anim-distance));
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes page-slide-right {
    from {
        opacity: 0;
        transform: translateX(calc(var(--page-anim-distance) * -1));
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes page-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes page-zoom-in {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes page-sheet-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes page-sheet-down {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card animations (modes) */
body.card-anim-none .screen .card {
    opacity: 1;
    transform: none;
    transition: none;
}

body.card-anim-stagger .screen .card,
body.card-anim-zoom .screen .card {
    opacity: 0;
    transition: opacity var(--card-anim-duration) ease-out,
                transform var(--card-anim-duration) ease-out;
}

body.card-anim-stagger .screen .card {
    transform: translateY(var(--card-anim-distance));
}

body.card-anim-stagger.cards-enter-ready .screen .card {
    opacity: 1;
    transform: translateY(0);
}

body.card-anim-zoom .screen .card {
    transform: scale(0.96);
}

body.card-anim-zoom.cards-enter-ready .screen .card {
    opacity: 1;
    transform: scale(1);
}


/* Карточки жетонов на странице профиля (2 на ряд в мобильном виде) */
.token-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: start; /* не растягиваем карточки по высоте из-за соседей */
}

/*
  Важно: в проекте есть общий (старый) .token-card как flex-контейнер.
  Для нового квадратного UI в профиле карточка должна быть блочной,
  иначе .token-card-inner не растягивается по ширине и выглядит "узкой".
*/
.token-cards-grid .token-card {
    /* Перебиваем старый align-items:flex-start у общего .token-card */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
    align-self: start;
    /* Квадратные карточки (идеальный квадрат без горизонтального скролла) */
    aspect-ratio: 1 / 1;
    /* Единый радиус для карточки и рамки */
    --token-card-radius: 18px;
    --token-border-outset: 2px; /* рамка чуть "выезжает" наружу */
    --token-border-inset: calc(-1 * var(--token-border-outset));
    will-change: transform;
}

/* Плавное удаление просроченного (неоплаченного) жетона + корректное перестроение сетки */
.token-cards-grid .token-card.is-removing {
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 200ms ease, transform 200ms ease;
}

.token-cards-grid .token-card-inner {
    position: relative;
    padding: 8px;
    border-radius: var(--token-card-radius);
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: var(--color-bg-soft, rgba(15,23,42,0.9));
    box-shadow: 0 0 0 1px rgba(15,23,42,0.6), 0 10px 20px rgba(15,23,42,0.8);
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.token-cards-grid .token-card-image-wrap {
    position: relative;
    margin-bottom: 6px;
    overflow: hidden;
    border-radius: calc(var(--token-card-radius) - 6px);
    flex: 0 0 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15,23,42,0.55);
}

/* Реальные изображения жетонов — сохраняем пропорции, вписываем в блок */
.token-card-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* Плейсхолдер, если нет картинки: квадратная плашка с буквой */
.token-card-image--placeholder {
    width: 100%;
    height: 100%;
    padding-top: 0;
    border-radius: calc(var(--token-card-radius) - 6px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(15,23,42,0.8);
}

.token-card-qty-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    background: #e53935;
    color: #fff;
}

.token-card-title {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 13px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.token-card-sub {
    font-size: 11px;
    opacity: 0.8;
    line-height: 1.15;
}

.token-card-meta--compact {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.15;
    opacity: 0.9;
    flex-wrap: nowrap;
}
.token-card-meta--compact .tmi {
    display: inline-block;
    min-width: 1.1em;
    text-align: center;
}
.token-card-meta--compact .tmv {
    font-variant-numeric: tabular-nums;
    opacity: 0.98;
}


.token-card-timer {
    margin-top: 6px;
    font-family: monospace;
    font-size: 14px;
}

.token-card-actions {
    display: block;
    margin-top: auto; /* кнопка всегда внизу квадрата */
}


/* Карточки жетонов: визуальные состояния и «змейка» по периметру */
.token-card {
    position: relative;
    /* Дефолты для рамки/анимаций (нужны также для превью в админке) */
    --token-card-radius: 18px;
    --token-border-outset: 2px;
    --token-border-inset: calc(-1 * var(--token-border-outset));
}

.token-card-border {
    position: absolute;
    inset: var(--token-border-inset, -2px);
    border-radius: calc(var(--token-card-radius, 18px) + var(--token-border-outset, 2px));
    pointer-events: none;
    z-index: 1;
}

/* Содержимое карточки всегда поверх рамки/змейки */
.token-card-inner {
    position: relative;
    z-index: 2;
}

/* Статусы периметра */
.token-card.state-not-started .token-card-border {
    border: 2px solid #ff9800; /* оранжевый */
}

.token-card.state-ready .token-card-border {
    border: 2px solid #00c853; /* зелёный */
}

.token-card.state-collected .token-card-border {
    border: 2px solid #ff5252; /* красный */
}
.token-card.state-await-pay .token-card-border {
    border: 2px solid #e63b4b;
    box-shadow: 0 0 0 0 rgba(230,59,75,0.55);
    animation: await-pay-pulse 1.35s infinite;
}

@keyframes await-pay-pulse {
    0% { box-shadow: 0 0 0 0 rgba(230,59,75,0.55); transform: translateY(0); }
    70% { box-shadow: 0 0 0 14px rgba(230,59,75,0); transform: translateY(-1px); }
    100% { box-shadow: 0 0 0 0 rgba(230,59,75,0); transform: translateY(0); }
}


/* Змейка для работающего таймера */
@keyframes token-snake-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.token-card.state-running.anim-snake .token-card-border {
    padding: 2px; /* толщина «змейки» */
    background: conic-gradient(
        from 0deg,
        #00e5ff,
        #7c4dff,
        #ffea00,
        #00e5ff
    );
    animation: token-snake-spin 4s linear infinite;
    /* маска, чтобы оставить только рамку по периметру */
    mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
}

/* Доп. анимации рамки для статуса «в работе» (выбор в админке) */
.token-card.state-running.anim-ants .token-card-border{
    border-radius: calc(var(--token-card-radius) + var(--token-border-outset));
}
.token-card.state-running.anim-ants .token-card-border::before{
    content:"";
    position:absolute;
    inset:0;
    border-radius:inherit;
    padding:2px;
    background:
        repeating-linear-gradient(90deg,
            rgba(255,255,255,0.08) 0 8px,
            rgba(0,229,255,0.85) 8px 12px,
            rgba(255,255,255,0.08) 12px 20px
        );
    background-size: 240px 100%;
    animation: token-ants-march 1.15s linear infinite;
    mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
}
@keyframes token-ants-march{
    from{ background-position: 0 0; }
    to  { background-position: -240px 0; }
}

/* Вариант 2: «сияющий обод» (мягкая аура по периметру) */
.token-card.state-running.anim-aura .token-card-border::before{
    content:"";
    position:absolute;
    inset:0;
    border-radius:inherit;
    padding:2px;
    background: linear-gradient(120deg, rgba(0,229,255,0.9), rgba(124,77,255,0.85), rgba(255,234,0,0.85), rgba(0,229,255,0.9));
    background-size: 280% 280%;
    animation: token-aura-flow 3.2s ease-in-out infinite;
    filter: blur(0.2px) drop-shadow(0 0 10px rgba(0,229,255,0.18));
    mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
}
@keyframes token-aura-flow{
    0%{ background-position: 0% 50%; }
    50%{ background-position: 100% 50%; }
    100%{ background-position: 0% 50%; }
}

/* Цвета таймера по статусам */
.token-card.state-not-started .token-card-timer {
    color: #ffb74d; /* мягкий оранжевый */
}

.token-card.state-ready .token-card-timer {
    color: #00e676;
    font-weight: 600;
}

.token-card.state-collected .token-card-timer {
    color: #ff5252;
    font-weight: 500;
}

/* Перелив текста таймера, когда идёт отсчёт */
@keyframes token-timer-gradient {
    from { background-position: 0 0;   }
    to   { background-position: 200% 0; }
}

.token-card.state-running .token-card-timer {
    background: linear-gradient(90deg, #ffeb3b, #00e5ff, #ffeb3b);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    color: transparent;
    animation: token-timer-gradient 2s linear infinite;
}


/* Текст/эмодзи вместо SVG-иконок на кнопках жетонов */
.token-icon-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}


/* Админские таблицы: читаемые заголовки и строки без разрыва слов на десктопе */
.admin-layout .admin-wrapper {
    overflow-x: auto;
}

.admin-layout .table {
    table-layout: auto;
}

.admin-layout .table th,
.admin-layout .table td {
    white-space: nowrap;
    word-wrap: normal;
    word-break: normal;
}

/* Админка (десктоп): используем всю ширину страницы и избегаем обрезаний */
.admin-layout .app-main {
    max-width: 100%;
    padding: 84px 24px 32px;
}

.admin-layout .app-bottom-nav {
    display: none;
}

/* В админке карточки не должны обрезать содержимое (кнопки/таблицы/тени) */
.admin-layout .card {
    overflow: visible;
}

.admin-layout .screen {
    max-width: 100%;
    width: 100%;
    margin: 0 auto 16px;
    padding: 18px 18px 20px;
    overflow-x: auto;
}

/* Табличные контейнеры в админке: всегда скроллятся по горизонтали при необходимости */
.admin-layout .table-wrapper,
.admin-layout .table-scroll-x,
.admin-layout .table-wrapper-horizontal {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Формы в строку на десктопе: переносим элементы, чтобы не уезжали за края */
.admin-layout .form-inline {
    flex-wrap: wrap;
    align-items: center;
}

/* На больших экранах делаем меню админки более "компьютерным" */
@media (min-width: 1024px) {
    .admin-layout .admin-nav-link {
        min-width: 140px;
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* Кнопки и элементы управления в таблицах не должны прятаться/ломаться */
.admin-layout .table td {
    vertical-align: middle;
}

.admin-layout .table td .btn,
.admin-layout .table td button,
.admin-layout .table td a.btn {
    white-space: nowrap;
}

/* ---- Финансовая панель (fin_moderator) ---- */
.fin-dashboard .fin-header{display:flex;justify-content:space-between;align-items:flex-end;gap:12px;margin-bottom:14px;}
.fin-dashboard .fin-title{font-size:20px;margin:0;}
.fin-dashboard .fin-subtitle{font-size:12px;opacity:.8;margin-top:4px;}

.fin-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:14px;}
.fin-card{display:block;text-decoration:none;color:inherit;border:1px solid rgba(255,255,255,.08);border-radius:16px;padding:12px;box-shadow:0 8px 18px rgba(0,0,0,.08);background:rgba(255,255,255,.04);}
body[data-theme="light"] .fin-card{background:#fff;border-color:rgba(0,0,0,.08);}
.fin-card-label{font-size:12px;opacity:.85;}
.fin-card-value{font-size:26px;font-weight:700;margin-top:6px;line-height:1.1;}
.fin-card-sub{font-size:11px;opacity:.8;margin-top:6px;}

.fin-grid{display:grid;grid-template-columns:2fr 1fr;gap:12px;}
.fin-block-title{font-size:13px;font-weight:600;margin-bottom:8px;}
.fin-chart-legend{display:flex;align-items:center;gap:10px;font-size:11px;opacity:.85;margin-bottom:10px;}
.fin-dot{display:inline-block;width:10px;height:10px;border-radius:999px;vertical-align:middle;}
.fin-dot-a{background:rgba(59,130,246,.9);} /* blue */
.fin-dot-b{background:rgba(245,158,11,.9);} /* amber */

.fin-bars{display:flex;gap:8px;align-items:flex-end;height:160px;padding:10px 6px 6px;border-radius:14px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06);}
body[data-theme="light"] .fin-bars{background:rgba(0,0,0,.02);border-color:rgba(0,0,0,.06);}
.fin-bar{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;}
.fin-bar-stack{position:relative;width:100%;max-width:28px;height:120px;display:flex;flex-direction:column;justify-content:flex-end;gap:3px;}
.fin-bar-m,.fin-bar-e{border-radius:8px;min-height:2px;}
.fin-bar-m{background:rgba(59,130,246,.85);} 
.fin-bar-e{background:rgba(245,158,11,.85);} 
.fin-bar-label{font-size:10px;opacity:.75;}

.fin-quick .fin-quick-links{display:flex;flex-direction:column;gap:8px;}

@media (max-width: 900px){
  .fin-cards{grid-template-columns:1fr;}
  .fin-grid{grid-template-columns:1fr;}
  .fin-bars{height:150px;}
}


/* Мобильный UI: убираем зум при фокусе на инпутах (iOS требует шрифт >=16px) */
body:not(.admin-layout) input[type="text"],
body:not(.admin-layout) input[type="password"],
body:not(.admin-layout) input[type="number"],
body:not(.admin-layout) input[type="tel"],
body:not(.admin-layout) input[type="email"] {
    font-size: 16px;
}

/* Мобильный UI: формы-покупки и подобные в колонку (вариант B) */
body:not(.admin-layout) .form-inline {
    flex-direction: column;
    align-items: flex-start;
}

/* Поле количества жетонов — компактное и читаемое */
body:not(.admin-layout) .form-inline input[type="number"][name="quantity"] {
    max-width: 120px;
    width: 100%;
    text-align: center;
}


/* Универсальная кнопка действия для жетона в профиле */
.token-action-btn {
    display: block;
    width: 100%;
    /* Внутри квадратной карточки кнопка всегда "прилипает" к низу */
    margin-top: auto;
    border-radius: 999px;
    padding: 9px 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.token-action-btn .pay-btn-label{display:inline-block}
.token-action-btn .pay-btn-timer{display:inline-block;margin-left:8px;padding:2px 8px;border-radius:999px;background:rgba(0,0,0,.22);font-weight:800;font-size:12px;line-height:1.2;font-variant-numeric:tabular-nums;letter-spacing:.2px}
.token-action-btn .pay-btn-timer.is-expired{background:rgba(0,0,0,.30);opacity:.95}

.token-action-btn:disabled {
    cursor: default;
    opacity: 0.9;
}

/* Цвета кнопки по состояниям карточки */
.token-card.state-not-started .token-action-btn {
    display: block;
    background: #ff9800;
    color: #111827;
}

.token-card.state-ready .token-action-btn {
    display: block;
    background: #00c853;
    color: #ffffff;
}

.token-card.state-collected .token-action-btn {
    display: block;
    background: #ff5252;
    color: #ffffff;
}

/* Перелив для кнопки, когда идёт отсчёт */

.token-card.state-await-pay .token-action-btn {
    background-image: linear-gradient(90deg, #ff5252, #ff9800, #ff5252);
    background-size: 200% 100%;
    color: #ffffff;
    animation: await-pay-gradient 1.6s linear infinite;
}

@keyframes await-pay-gradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
.token-card.state-running .token-action-btn {
    display: block;
    background-image: linear-gradient(90deg, #00e5ff, #7c4dff, #ffea00, #00e5ff);
    background-size: 200% 100%;
    color: #111827;
    animation: token-timer-gradient 2s linear infinite;
}

/* Скрываем отдельную строку таймера, чтобы не дублировать текст */
.token-card .token-card-timer {
    display: none;
}


/* === Диагностика интеграций === */
.status-ok {
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(22,163,74,0.12);
    color: #22c55e;
    font-weight: 600;
}

.status-warn {
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(234,179,8,0.15);
    color: #facc15;
    font-weight: 600;
}

.status-bad {
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(239,68,68,0.12);
    color: #ef4444;
    font-weight: 600;
}

.admin-diagnostics ul.diag-list {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}

.admin-diagnostics ul.diag-list li {
    margin-bottom: 6px;
}

.admin-diagnostics h3 {
    margin-top: 0;
}



/* User balance indicator (fixed in header) */
.user-balance-indicator{display:flex;flex-direction:column;align-items:flex-end;margin-right:10px;}
.user-balance-label{font-size:10px;text-transform:uppercase;letter-spacing:.08em;color:rgba(148,163,184,.9);margin-bottom:2px;}
.user-balance-value{font-size:14px;font-weight:800;line-height:1;color:var(--color-accent);text-shadow:0 0 10px rgba(59,130,246,.25);}
.user-balance-unit{font-size:11px;font-weight:700;margin-left:6px;color:var(--color-text);opacity:.9;}


/* Admin: preview for token running border animations */
.token-anim-preview-grid{
    display:flex;
    flex-wrap:wrap;
    gap:12px;
    margin-top:10px;
}
.token-anim-preview-item{
    flex:0 0 auto;
}
.token-anim-preview-item.is-active{
    filter: drop-shadow(0 0 10px rgba(0,229,255,0.18));
}
.token-anim-preview-card{
    width:140px;
    height:86px;
    border-radius:16px;
    overflow:hidden;
    background: rgba(255,255,255,0.04);
}
.token-anim-preview-card .token-card-inner{
    display:flex;
    align-items:flex-end;
    height:100%;
    padding:10px;
}
.token-anim-preview-title{
    font-size:12px;
    opacity:0.85;
    font-family: monospace;
}



/* Дополнительные анимации рамки жетона в статусе «в работе» */

/* Радар: узкий луч, который вращается вокруг рамки */
@keyframes token-radar-spin{ from{ transform: rotate(0deg);} to{ transform: rotate(360deg);} }
.token-card.state-running.anim-radar .token-card-border{
    padding: 2px;
    background: conic-gradient(
        from 0deg,
        rgba(0,255,170,0) 0deg,
        rgba(0,255,170,0) 300deg,
        rgba(0,255,170,0.85) 330deg,
        rgba(0,255,170,0) 360deg
    );
    animation: token-radar-spin 2.2s linear infinite;
    filter: drop-shadow(0 0 12px rgba(0,255,170,0.16));
}
.token-card.state-running.anim-radar .token-card-border::before{
    content:'';
    position:absolute;
    inset:2px;
    border-radius: var(--token-card-radius);
    background: var(--card-bg, rgba(0,0,0,0.25));
}

/* Прогресс: рамка “заполняется” по периметру, как индикатор */
@property --tokenProg {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
@keyframes token-progress-fill{
    0%   { --tokenProg: 0deg; }
    100% { --tokenProg: 360deg; }
}
.token-card.state-running.anim-progress .token-card-border{
    padding:2px;
    background: conic-gradient(
        from -90deg,
        rgba(0,229,255,0.95) 0deg var(--tokenProg),
        rgba(124,77,255,0.22) var(--tokenProg) 360deg
    );
    animation: token-progress-fill 7.0s linear infinite;
    filter: drop-shadow(0 0 10px rgba(0,229,255,0.14));
}
.token-card.state-running.anim-progress .token-card-border::before{
    content:'';
    position:absolute;
    inset:2px;
    border-radius: var(--token-card-radius);
    background: var(--card-bg, rgba(0,0,0,0.25));
}

/* Орбита: две точки бегут по периметру */
@keyframes token-orbit{ from{ offset-distance:0%; } to{ offset-distance:100%; } }
.token-card.state-running.anim-orbit .token-card-border{
    border: 2px solid rgba(124,77,255,0.35);
    box-shadow: 0 0 0 0 rgba(124,77,255,0.0);
}
.token-card.state-running.anim-orbit .token-card-border::before,
.token-card.state-running.anim-orbit .token-card-border::after{
    content:'';
    position:absolute;
    width:10px;
    height:10px;
    border-radius:50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.95), rgba(0,229,255,0.75) 35%, rgba(124,77,255,0.1) 70%);
    offset-path: inset(0 round calc(var(--token-card-radius) + var(--token-border-outset)));
    offset-distance: 0%;
    animation: token-orbit 2.6s linear infinite;
    filter: drop-shadow(0 0 10px rgba(0,229,255,0.25));
}
.token-card.state-running.anim-orbit .token-card-border::after{
    width:8px;
    height:8px;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.85), rgba(255,234,0,0.65) 35%, rgba(255,234,0,0.08) 70%);
    animation-duration: 3.4s;
    animation-direction: reverse;
}