/* ==========================================================================
   VeltGame Admin — тёмная тема в стиле мини-аппа.
   Палитра и шрифт взяты один в один из src/webapp/static/style.css, чтобы
   админка и приложение выглядели единым продуктом.
   ========================================================================== */
:root {
    --bg: #01040D;
    --bg-grad-2: #050B18;
    --card: #0B1120;
    --card2: #111827;
    --btn: #131A2A;
    --btn-hover: #171C27;

    --white: #E6EDFF;
    --muted: rgba(230, 237, 255, .55);
    --muted2: rgba(230, 237, 255, .42);

    --brand-1: #0851B1;
    --brand-2: #3C90FF;
    --brand: #0152FF;
    --brand-grad: linear-gradient(135deg, #0851B1 0%, #3C90FF 100%);
    --brand-glow: 0 0 30px rgba(1, 82, 255, .30);

    --ok: #37D67A;
    --warn: #FFB020;
    --err: #FF5B6E;

    --hairline: rgba(230, 237, 255, .10);
    --hairline-2: rgba(230, 237, 255, .16);
    --glow: 0 0 0 1px rgba(230, 237, 255, .06), 0 8px 30px rgba(0, 0, 0, .55);
    --radius: 16px;
    --ease: cubic-bezier(.22, .61, .36, 1);
    --font: "Inter Tight", "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(60, 144, 255, .10), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-grad-2) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--white);
    font-family: var(--font);
    letter-spacing: -0.02em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Safari на iOS иначе сам увеличивает шрифт в блоках, которые считает
       «слишком узкими», и вёрстка на телефоне разъезжается. */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ===================== Экран входа ===================== */
.login-container {
    display: flex; align-items: center; justify-content: center;
    /* dvh вместо vh: на телефоне 100vh считается без адресной строки, и поле
       ввода с кнопкой уезжают под неё. Строка с vh оставлена для браузеров,
       которые dvh не понимают. */
    min-height: 100vh; min-height: 100dvh; padding: 20px;
}
.login-box {
    background: var(--card);
    border: 1px solid var(--hairline);
    border-radius: 20px;
    padding: 36px 30px;
    box-shadow: var(--glow);
    max-width: 380px; width: 100%;
}
.login-logo {
    font-size: 26px; font-weight: 800; letter-spacing: -0.04em;
    text-align: center; margin-bottom: 6px;
}
.login-logo span {
    background: var(--brand-grad); -webkit-background-clip: text;
    background-clip: text; -webkit-text-fill-color: transparent;
}
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.login-box input {
    width: 100%; padding: 15px;
    background: var(--bg);
    border: 1px solid var(--hairline-2);
    border-radius: 13px;
    color: var(--white); font-family: var(--font);
    font-size: 15px; font-weight: 500; letter-spacing: -0.02em;
    margin-bottom: 16px;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.login-box input:focus {
    outline: none; border-color: var(--brand-2);
    box-shadow: 0 0 0 3px rgba(60, 144, 255, .16);
}
.login-box button {
    width: 100%; padding: 15px;
    background: var(--brand-grad); color: var(--white);
    border: none; border-radius: 13px;
    font-family: var(--font); font-size: 15px; font-weight: 600; letter-spacing: -0.02em;
    cursor: pointer; box-shadow: var(--brand-glow);
    transition: transform .12s var(--ease), filter .2s var(--ease);
}
.login-box button:active { transform: scale(.98); filter: brightness(.96); }
.login-error {
    background: rgba(255, 91, 110, .10); color: var(--err);
    border: 1px solid rgba(255, 91, 110, .32);
    padding: 12px; border-radius: 12px; margin-bottom: 16px;
    text-align: center; font-size: 13px; display: none;
}

/* ===================== Шапка ===================== */
.admin-panel { display: none; }
.header {
    background: rgba(11, 17, 32, .72);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--hairline);
    padding: 16px 22px; position: sticky; top: 0; z-index: 20;
}
.header-content {
    max-width: 1320px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.header h1 { font-size: 19px; font-weight: 800; letter-spacing: -0.04em; }
.header h1 span {
    background: var(--brand-grad); -webkit-background-clip: text;
    background-clip: text; -webkit-text-fill-color: transparent;
}
.header-stats { display: flex; gap: 26px; margin-left: auto; margin-right: 8px; }
.stat-item { text-align: right; }
.stat-value { font-size: 19px; font-weight: 700; color: var(--white); letter-spacing: -0.03em; }
.stat-label { font-size: 11px; color: var(--muted2); text-transform: uppercase; letter-spacing: .04em; }
.logout-btn {
    background: var(--btn); color: var(--white);
    border: 1px solid var(--hairline-2); padding: 9px 16px;
    border-radius: 10px; cursor: pointer; font-family: var(--font);
    font-weight: 600; font-size: 13px; transition: background .2s var(--ease);
}
.logout-btn:hover { background: var(--btn-hover); }

.container {
    max-width: 1340px; margin: 0 auto; padding: 22px;
    display: flex; gap: 20px; align-items: flex-start;
}

/* ===================== Сайдбар (навигация) ===================== */
.sidebar {
    width: 242px; flex: 0 0 242px;
    position: sticky; top: 78px;
    display: flex; flex-direction: column; gap: 2px;
    max-height: calc(100vh - 100px); overflow-y: auto;
    background: rgba(11, 17, 32, .5);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 10px; box-shadow: var(--glow);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--hairline-2); border-radius: 3px; }

.nav-group { display: flex; flex-direction: column; }
.nav-group-head {
    width: 100%; display: flex; align-items: center; gap: 10px;
    background: transparent; border: none; cursor: pointer;
    padding: 11px 11px; border-radius: 10px;
    font-family: var(--font); font-weight: 700; font-size: 11px;
    text-transform: uppercase; letter-spacing: .08em; color: var(--muted2);
    transition: color .15s var(--ease), background .15s var(--ease);
}
.nav-group-head:hover { color: var(--white); background: rgba(230, 237, 255, .035); }
.ng-ico { font-size: 15px; line-height: 1; width: 18px; text-align: center; }
.ng-name { flex: 1 1 auto; text-align: left; }
.ng-chev {
    width: 6px; height: 6px; border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor; transform: rotate(-45deg);
    transition: transform .22s var(--ease); opacity: .55; margin-right: 4px;
}
.nav-group.open .ng-chev { transform: rotate(45deg); opacity: .9; }
.nav-group.open .nav-group-head { color: var(--white); }

.nav-group-items {
    display: flex; flex-direction: column; gap: 2px;
    overflow: hidden; max-height: 0; padding: 0 0 0 8px;
    transition: max-height .24s var(--ease), padding .24s var(--ease);
}
.nav-group.open .nav-group-items { max-height: 340px; padding: 3px 0 8px 8px; }

.sidebar .tab {
    width: 100%; text-align: left; background: transparent;
    border: 1px solid transparent; padding: 9px 12px; border-radius: 10px;
    color: var(--muted); font-weight: 600; font-size: 13px; letter-spacing: -0.02em;
    cursor: pointer; font-family: var(--font); display: flex; align-items: center;
    transition: color .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.sidebar .tab:hover { color: var(--white); background: rgba(230, 237, 255, .04); }
.sidebar .tab.active {
    color: var(--white);
    background: linear-gradient(135deg, rgba(8, 81, 177, .26), rgba(60, 144, 255, .07));
    border-color: rgba(60, 144, 255, .28);
    box-shadow: inset 2px 0 0 var(--brand-2);
}

.content {
    flex: 1 1 auto; min-width: 0;
    background: var(--card); border: 1px solid var(--hairline);
    border-radius: var(--radius); padding: 22px; box-shadow: var(--glow);
}

/* юзер в таблицах теперь открывает профиль — курсор как у ссылки */
.link { cursor: pointer; }

/* Бургер и затемнение шторки — по умолчанию скрыты (видны только на мобиле). */
.menu-btn { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 920px) {
    html, body { overflow-x: hidden; }

    .menu-btn {
        display: inline-flex; align-items: center; justify-content: center;
        width: 42px; height: 42px; border-radius: 11px; flex: 0 0 auto;
        background: var(--btn); border: 1px solid var(--hairline-2);
        color: var(--white); font-size: 19px; cursor: pointer; line-height: 1;
    }

    /* align-items: stretch ОБЯЗАТЕЛЕН: на десктопе у .container стоит flex-start
       (чтобы контент не тянулся под высоту сайдбара), но в колонке это заставляло
       .content сжиматься по содержимому — узкая форма на одних вкладках и вылезающая
       вправо таблица на других. stretch растягивает контент на всю ширину. */
    .container { flex-direction: column; align-items: stretch; padding: 14px; gap: 0; }
    .content { width: 100%; }

    /* Сайдбар — выезжающая слева шторка, в потоке места не занимает. */
    .sidebar {
        position: fixed; top: 0; left: 0; z-index: 60;
        width: 286px; max-width: 86vw; height: 100vh; height: 100dvh;
        max-height: none; border-radius: 0 18px 18px 0;
        transform: translateX(-102%); transition: transform .26s var(--ease);
        padding: 16px 12px; gap: 2px;
        box-shadow: 24px 0 60px rgba(0, 0, 0, .55);
    }
    body.nav-open .sidebar { transform: none; }

    .sidebar-backdrop {
        display: block; position: fixed; inset: 0; z-index: 55;
        background: rgba(1, 4, 13, .62);
        backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
        opacity: 0; pointer-events: none; transition: opacity .26s var(--ease);
    }
    body.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    body.nav-open { overflow: hidden; }

    /* Профиль игрока — почти на весь экран. */
    .pm-overlay { padding: 0; align-items: stretch; }
    .pm-modal { max-width: 100%; border-radius: 0; min-height: 100dvh; padding: 20px 15px 34px; }
    .pm-head { padding-right: 44px; }
    .pm-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ===================== Лоск контента ===================== */
.content { padding: 26px 26px 30px; }
.tab-content h2 {
    font-size: 19px; font-weight: 800; letter-spacing: -0.035em;
    margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
}
.tab-content h2::before {
    content: ""; width: 4px; height: 19px; border-radius: 3px;
    background: var(--brand-grad); box-shadow: var(--brand-glow);
}
/* таблицы — в аккуратной рамке со скруглением */
.tab-content table, .pm-body table {
    border: 1px solid var(--hairline); border-radius: 13px;
    overflow: hidden; background: rgba(230, 237, 255, .012);
}
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
tr:last-child td { border-bottom: none; }
tr { transition: background .12s var(--ease); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 18px; }
.tab-content h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 14px; }

/* ===================== Таблицы ===================== */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
    text-align: left; padding: 11px 12px; font-weight: 600; color: var(--muted);
    border-bottom: 1px solid var(--hairline-2); text-transform: uppercase;
    font-size: 11px; letter-spacing: .04em; white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--hairline); color: var(--white); }
tr:hover td { background: rgba(230, 237, 255, .02); }

.badge {
    display: inline-block; padding: 4px 11px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; letter-spacing: -0.01em;
}
.badge-success, .badge-paid, .badge-active { background: rgba(55, 214, 122, .14); color: var(--ok); border: 1px solid rgba(55, 214, 122, .32); }
.badge-pending { background: rgba(255, 176, 32, .14); color: var(--warn); border: 1px solid rgba(255, 176, 32, .32); }
/* processing — вывод уже отправлен платёжке, ответа ещё нет: не ошибка, но и
   не выплата, поэтому свой синий, а не жёлтый «ожидает». */
.badge-processing { background: rgba(60, 144, 255, .14); color: var(--brand-2); border: 1px solid rgba(60, 144, 255, .32); }
.badge-failed, .badge-rejected, .badge-disabled { background: rgba(255, 91, 110, .12); color: var(--err); border: 1px solid rgba(255, 91, 110, .30); }
.badge-neutral, .badge-used_up { background: rgba(230, 237, 255, .06); color: var(--muted); border: 1px solid var(--hairline-2); }

.live-indicator {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: var(--brand-2); margin-right: 7px;
    box-shadow: 0 0 8px rgba(60, 144, 255, .9); animation: pulse 2.2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.empty-state { text-align: center; padding: 54px 20px; color: var(--muted2); font-size: 14px; }
.loading { text-align: center; padding: 40px; color: var(--muted); font-size: 14px; }

/* ===================== Формы, фильтры ===================== */
.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters input, .filters select, .field-input, .field-select {
    padding: 11px 13px; background: var(--bg);
    border: 1px solid var(--hairline-2); border-radius: 11px;
    color: var(--white); font-family: var(--font); font-size: 14px; letter-spacing: -0.02em;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.filters input:focus, .filters select:focus, .field-input:focus, .field-select:focus {
    outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(60, 144, 255, .14);
}
.form-col { max-width: 560px; }
/* Поиск игрока шире остальных полей: туда вписывают username целиком.
   Класс, а не инлайновый style — иначе мобильные правила его не переопределят. */
.search-input { min-width: 280px; }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 13px; color: var(--muted); }
.field-input, .field-select { width: 100%; }

.btn-primary {
    padding: 13px 26px; background: var(--brand-grad); color: var(--white);
    border: none; border-radius: 12px; font-family: var(--font);
    font-size: 14px; font-weight: 600; letter-spacing: -0.02em; cursor: pointer;
    box-shadow: var(--brand-glow); transition: transform .12s var(--ease), filter .2s var(--ease);
}
.btn-primary:active { transform: scale(.98); filter: brightness(.96); }
.btn-ghost {
    padding: 13px 22px; background: var(--btn); color: var(--white);
    border: 1px solid var(--hairline-2); border-radius: 12px; font-family: var(--font);
    font-size: 14px; font-weight: 600; cursor: pointer; transition: background .2s var(--ease);
}
.btn-ghost:hover { background: var(--btn-hover); }
.btn-danger {
    padding: 10px 18px; background: rgba(255, 91, 110, .12); color: var(--err);
    border: 1px solid rgba(255, 91, 110, .30); border-radius: 10px; font-family: var(--font);
    font-size: 13px; font-weight: 600; cursor: pointer; transition: background .2s var(--ease);
}
.btn-danger:hover { background: rgba(255, 91, 110, .2); }
.btn-ok {
    padding: 10px 18px; background: rgba(55, 214, 122, .14); color: var(--ok);
    border: 1px solid rgba(55, 214, 122, .32); border-radius: 10px; font-family: var(--font);
    font-size: 13px; font-weight: 600; cursor: pointer; transition: background .2s var(--ease);
}
.btn-ok:hover { background: rgba(55, 214, 122, .22); }

.link { color: var(--brand-2); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.pos { color: var(--ok); font-weight: 700; }
.neg { color: var(--err); font-weight: 700; }

/* ===================== Дашборд / статистика ===================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.stat-card {
    background: var(--card2); border: 1px solid var(--hairline);
    border-radius: var(--radius); padding: 20px;
}
.stat-card .big { font-size: 27px; font-weight: 800; letter-spacing: -0.04em; margin-bottom: 4px; }
.stat-card .cap { color: var(--muted); font-size: 13px; }
.stat-card.accent { background: linear-gradient(140deg, #10203A 0%, #05080F 100%); border-color: rgba(60, 144, 255, .22); }

/* ===================== Лайв-лента ===================== */
.live-item {
    padding: 13px 15px; border-radius: 13px; margin-bottom: 10px;
    background: var(--card2); border: 1px solid var(--hairline);
    border-left: 3px solid var(--hairline-2);
}
.live-item.win { border-left-color: var(--ok); }
.live-item.loss { border-left-color: var(--err); }
.live-item.dep { border-left-color: var(--brand-2); }
.live-item.wd { border-left-color: var(--warn); }
.live-head { font-weight: 700; font-size: 14px; margin-bottom: 5px; letter-spacing: -0.02em; }
.live-body { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.live-body b { color: var(--white); font-weight: 600; }

/* Карточка промокода */
.promo-card {
    background: var(--card2); border: 1px solid var(--hairline);
    border-radius: var(--radius); padding: 18px; margin-bottom: 12px;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
}
.promo-code-name { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 8px; }
.promo-meta { color: var(--muted); font-size: 13px; line-height: 1.6; }
.promo-meta b { color: var(--white); font-weight: 600; }
.mini-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; margin-left: 8px; vertical-align: middle; }
.mini-badge.velts { background: rgba(60, 144, 255, .16); color: var(--brand-2); }
.mini-badge.percent { background: rgba(255, 176, 32, .16); color: var(--warn); }

/* Переключатель типа промокода */
.type-switch { display: flex; gap: 10px; }
.type-btn {
    flex: 1; padding: 13px; border-radius: 12px; cursor: pointer;
    font-family: var(--font); font-weight: 600; font-size: 14px; letter-spacing: -0.02em;
    background: var(--bg); color: var(--muted); border: 1px solid var(--hairline-2);
    transition: all .18s var(--ease);
}
.type-btn.active { background: var(--brand-grad); color: var(--white); border-color: transparent; box-shadow: var(--brand-glow); }

.result-ok {
    padding: 15px; background: rgba(55, 214, 122, .10);
    border: 1px solid rgba(55, 214, 122, .30); border-radius: 12px; color: var(--white);
}
.result-err {
    padding: 15px; background: rgba(255, 91, 110, .10);
    border: 1px solid rgba(255, 91, 110, .30); border-radius: 12px; color: var(--white);
}
.result-ok .rtitle { color: var(--ok); font-weight: 700; margin-bottom: 6px; }
.result-err .rtitle { color: var(--err); font-weight: 700; margin-bottom: 6px; }

.note-box {
    background: var(--card2); border-left: 3px solid var(--warn);
    border-radius: 10px; padding: 14px 16px; color: var(--muted); font-size: 13px;
    line-height: 1.6; margin-bottom: 22px;
}
.note-box b { color: var(--white); }

.status-line { font-size: 15px; margin-bottom: 22px; }
.status-line b { font-weight: 700; }
.hint-text { color: var(--muted2); font-size: 12.5px; margin-top: 8px; line-height: 1.5; }

.mono { font-variant-numeric: tabular-nums; }
.warn { color: var(--warn); font-weight: 700; }

/* Таблицы скроллятся по горизонтали внутри своей обёртки. На широком экране
   обёртка не видна, на телефоне спасает семиколоночные таблицы от сжатия. */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 100%; }

/* ===================== Казна ===================== */
.period-switch { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.period-btn {
    padding: 9px 16px; border-radius: 10px; cursor: pointer;
    font-family: var(--font); font-weight: 600; font-size: 13px; letter-spacing: -0.02em;
    background: var(--bg); color: var(--muted); border: 1px solid var(--hairline-2);
    transition: all .18s var(--ease);
}
.period-btn:hover { color: var(--white); }
.period-btn.active { background: var(--brand-grad); color: var(--white); border-color: transparent; box-shadow: var(--brand-glow); }

/* Блоки казны: приход, расход, касса, платёжки, обязательства */
.tr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.tr-block {
    background: var(--card2); border: 1px solid var(--hairline);
    border-radius: var(--radius); padding: 18px;
}
.tr-block h4 {
    font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase;
    letter-spacing: .05em; margin-bottom: 14px;
}
.tr-row {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 8px 0; font-size: 13.5px; color: var(--muted);
    border-bottom: 1px solid var(--hairline);
}
.tr-row:last-child { border-bottom: none; }
.tr-row b { color: var(--white); font-weight: 600; font-variant-numeric: tabular-nums; }
.tr-row.total { margin-top: 6px; border-top: 1px solid var(--hairline-2); border-bottom: none; padding-top: 12px; }
.tr-row.total span { color: var(--white); font-weight: 600; }
.tr-row.total b { font-size: 17px; font-weight: 800; letter-spacing: -0.03em; }
.tr-sub { color: var(--muted2); font-size: 12px; }

/* Итог кассы — крупным блоком: это главная цифра экрана. */
.tr-cash {
    background: linear-gradient(140deg, #10203A 0%, #05080F 100%);
    border: 1px solid rgba(60,144,255,.22);
    border-radius: var(--radius); padding: 20px; margin-bottom: 14px;
}
.tr-cash-big { font-size: 30px; font-weight: 800; letter-spacing: -0.04em; margin: 4px 0 6px; }
.tr-note { color: var(--muted2); font-size: 12px; line-height: 1.5; margin-top: 8px; }

/* ==========================================================================
   Пополнения / Выводы одной лентой
   Карточки, а не таблица: приход и расход отличаются цветом и рамкой, и такой
   список одинаково читается и на 24-дюймовом мониторе, и на телефоне —
   горизонтально скроллить нечего.
   ========================================================================== */
.cf-totals {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px; margin-bottom: 18px;
}
.cf-tot {
    background: var(--card2); border: 1px solid var(--hairline);
    border-radius: var(--radius); padding: 16px 18px;
}
.cf-tot-cap {
    font-size: 11px; font-weight: 700; color: var(--muted2);
    text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px;
}
.cf-tot-val {
    font-size: 23px; font-weight: 800; letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums; line-height: 1.1;
}
.cf-tot-val i {
    font-style: normal; font-size: 12px; font-weight: 600;
    color: var(--muted2); margin-left: 6px; letter-spacing: -0.01em;
}
.cf-tot-sub { font-size: 12px; color: var(--muted2); margin-top: 6px; }
.cf-tot-net { background: linear-gradient(140deg, #10203A 0%, #05080F 100%); border-color: rgba(60, 144, 255, .22); }

/* Кнопка «Обновить» держится справа только там, где для неё есть место. */
.cf-refresh { margin-left: auto; }

/* Свой период из календаря: два поля «с» и «по» отдельным рядом. */
.cf-dates { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.cf-date { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.cf-date input {
    min-height: 40px; padding: 8px 12px; background: var(--bg);
    border: 1px solid var(--hairline-2); border-radius: 10px;
    color: var(--white); font-family: var(--font); font-size: 13px; letter-spacing: -0.02em;
    /* Без этого календарь в браузере открывается белым поверх тёмной панели. */
    color-scheme: dark;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.cf-date input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(60, 144, 255, .14); }
/* Safari на iOS ставит дату по центру поля, а подпись «с» стоит слева. */
.cf-date input::-webkit-date-and-time-value { text-align: left; }
/* Даты выбраны — поля подсвечены, как активная кнопка периода: видно, какой из
   двух способов задаёт то, что на экране. */
.cf-dates.active .cf-date input { border-color: var(--brand-2); }

.cf-list { display: flex; flex-direction: column; gap: 10px; }
.cf-item {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    background: var(--card2); border: 1px solid var(--hairline);
    border-left: 3px solid var(--hairline-2);
    border-radius: 13px; padding: 13px 16px;
}
.cf-item.cf-in { border-left-color: var(--ok); background: linear-gradient(90deg, rgba(55, 214, 122, .05) 0%, var(--card2) 42%); }
.cf-item.cf-out { border-left-color: var(--err); background: linear-gradient(90deg, rgba(255, 91, 110, .05) 0%, var(--card2) 42%); }
.cf-item.cf-neutral { border-left-color: var(--brand-2); }

.cf-main { min-width: 0; }
.cf-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cf-amount {
    font-size: 19px; font-weight: 800; letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cf-amount i {
    font-style: normal; font-size: 11.5px; font-weight: 600;
    color: var(--muted2); margin-left: 5px;
}
.cf-amt-neutral { color: var(--brand-2); font-weight: 700; }

/* Плашка способа: у каждой платёжки свой оттенок, чтобы способ читался
   с одного взгляда и без чтения текста. */
.cf-method {
    display: inline-block; padding: 4px 11px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap;
    background: rgba(230, 237, 255, .06); color: var(--muted); border: 1px solid var(--hairline-2);
}
.cf-m-cryptobot { background: rgba(60, 144, 255, .14); color: var(--brand-2); border-color: rgba(60, 144, 255, .32); }
.cf-m-xrocket { background: rgba(255, 176, 32, .13); color: var(--warn); border-color: rgba(255, 176, 32, .30); }
.cf-m-card { background: rgba(160, 120, 255, .14); color: #A78BFF; border-color: rgba(160, 120, 255, .32); }
.cf-m-transfer { background: rgba(230, 237, 255, .06); color: var(--muted); border-color: var(--hairline-2); }

.cf-sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.cf-dot { color: var(--muted2); margin: 0 6px; }

.cf-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.cf-tag {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted2);
}
.cf-item.cf-in .cf-tag { color: rgba(55, 214, 122, .75); }
.cf-item.cf-out .cf-tag { color: rgba(255, 91, 110, .75); }
.cf-usdt { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ==========================================================================
   ТЕЛЕФОН
   Всё ниже — только для узких экранов. Правила для ПК выше не тронуты:
   на широком мониторе панель выглядит ровно так, как выглядела.
   ========================================================================== */
@media (max-width: 900px) {
    /* Вкладок одиннадцать. На телефоне они переносами занимали пол-экрана,
       поэтому здесь это горизонтальная лента со скроллом. */
    .tabs {
        flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding-bottom: 4px; scrollbar-width: none;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { flex: 0 0 auto; scroll-snap-align: start; padding: 11px 15px; font-size: 13px; }

    /* Переключатели периодов — тем же приёмом. */
    .period-switch {
        flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
        padding-bottom: 4px; scrollbar-width: none;
    }
    .period-switch::-webkit-scrollbar { display: none; }
    .period-btn { flex: 0 0 auto; }
    /* На узком экране «Обновить» прижимать вправо некуда — просто в конце ряда. */
    .cf-refresh { margin-left: 0; padding: 9px 16px; font-size: 13px; }
}

@media (max-width: 720px) {
    /* Шапка: цифры не прячем, а переносим под логотип — они нужны чаще всего. */
    .header { padding: 12px 14px; }
    .header-content { flex-wrap: wrap; gap: 10px 14px; }
    .header h1 { font-size: 17px; }
    .header-stats {
        order: 3; width: 100%; margin: 0; gap: 0;
        display: grid; grid-template-columns: repeat(3, 1fr);
        border-top: 1px solid var(--hairline); padding-top: 10px;
    }
    .stat-item { text-align: left; }
    .stat-item + .stat-item { padding-left: 12px; border-left: 1px solid var(--hairline); }
    .stat-value { font-size: 16px; }
    .stat-label { font-size: 9.5px; letter-spacing: .03em; }
    .logout-btn { padding: 9px 14px; }

    .container { padding: 14px; }
    .content { padding: 14px; border-radius: 14px; }
    .tab-content h2 { font-size: 16px; margin-bottom: 14px; }

    /* Ленты со скроллом расширяем до края экрана: иначе последняя вкладка
       обрывается за 14px до края и кажется, что там ничего нет.
       Отрицательный отступ ровно равен паддингу контейнера. */
    .tabs { margin: 0 -14px 16px; padding-left: 14px; padding-right: 14px; }
    .period-switch { margin: 0 -14px 12px; padding-left: 14px; padding-right: 14px; }

    /* Даты делят ряд пополам. 16px обязательны и здесь: на меньшем шрифте
       Safari зумит страницу, как только открывается календарь. */
    .cf-dates { flex-wrap: nowrap; gap: 8px; margin-bottom: 12px; }
    .cf-date { flex: 1 1 0; min-width: 0; }
    .cf-date input { flex: 1 1 auto; width: 100%; min-width: 0; font-size: 16px; }

    /* Таблицы не сжимаем — они скроллятся в .table-wrap. Строки в одну линию,
       иначе «01.09.2026, 16:53» ломается на три и таблица становится нечитаемой. */
    table { font-size: 12.5px; }
    th, td { padding: 9px 10px; white-space: nowrap; }
    .table-wrap { margin: 0 -14px; padding: 0 14px; }

    /* Поля ввода: 16px обязательны, иначе Safari на iOS зумит страницу при
       фокусе и панель уезжает за край. Инлайновый min-width из разметки тоже
       снимаем — на 360px он вылезал за экран. */
    .filters { flex-direction: column; align-items: stretch; gap: 8px; }
    .filters input, .filters select,
    .field-input, .field-select, .search-input, .login-box input {
        font-size: 16px; padding: 12px 13px; width: 100%; min-width: 0;
    }
    .form-col { max-width: none; }

    /* Кнопки — по ширине контейнера и с нормальной зоной нажатия. */
    .btn-primary, .btn-ghost { width: 100%; min-height: 46px; font-size: 15px; }
    /* Кроме тех, что стоят в горизонтальной ленте переключателей: там кнопка
       во всю ширину вытолкнула бы сами переключатели за экран. */
    .period-switch .btn-ghost { width: auto; min-height: 0; }
    .btn-danger, .btn-ok { min-height: 42px; padding: 11px 16px; }
    .type-switch { flex-direction: column; }

    /* Ряды кнопок, собранные инлайновым flex в разметке (промокоды, баны,
       фейк-выплаты), на телефоне становятся столбцом. */
    .tab-content > div[style*="display:flex"] { flex-direction: column; align-items: stretch; }

    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 15px; }
    .stat-card .big { font-size: 21px; }
    .stat-card .cap { font-size: 11.5px; }

    /* Промокод: сумма и кнопки под текстом, а не рядом. */
    .promo-card { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; }
    .promo-card > div:last-child { align-items: stretch !important; }
    .promo-card .btn-danger, .promo-card .btn-ok { width: 100%; }
    .promo-code-name { font-size: 18px; }

    /* Казна */
    .tr-grid { grid-template-columns: 1fr; }
    .tr-block { padding: 15px; }
    .tr-row { font-size: 13px; }
    .tr-cash { padding: 16px; }
    .tr-cash-big { font-size: 25px; }

    /* Пополнения/Выводы: сумма и способ сверху, метка потока уходит в строку
       подписи — вертикальный столбик справа на узком экране только мешает. */
    .cf-totals { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .cf-tot { padding: 13px 14px; }
    .cf-tot-val { font-size: 19px; }
    .cf-tot-sub { font-size: 11.5px; }
    .cf-item { padding: 12px 13px; gap: 10px; align-items: flex-start; }
    .cf-amount { font-size: 17px; }
    .cf-sub { font-size: 12px; }
    .cf-dot { margin: 0 4px; }
    .cf-side { align-items: flex-end; }
    .cf-tag { font-size: 10px; }
    .cf-usdt { font-size: 12px; }

    .live-item { padding: 12px 13px; }
    .live-head { font-size: 13.5px; }
    .live-body { font-size: 12px; }
    .empty-state { padding: 38px 16px; font-size: 13px; }
}

@media (max-width: 420px) {
    /* Самые узкие телефоны: две цифры в шапке и один столбец плиток. */
    .header-stats { grid-template-columns: repeat(2, 1fr); }
    .header-stats .stat-item:nth-child(3) { display: none; }
    .stat-grid, .cf-totals { grid-template-columns: 1fr; }
    .cf-item { flex-direction: column; align-items: stretch; }
    .cf-side { flex-direction: row; align-items: baseline; justify-content: space-between; width: 100%; }
    .cf-top { gap: 8px; }
    .cf-amount { font-size: 16px; }
}

/* ===== Пополнения/Выводы (Cashflow) ===== */
.cf-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.cf-tot {
    background: var(--card2);
    border: 1px solid var(--hairline);
    border-radius: 12px;
    padding: 20px;
}

.cf-tot-cap {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 8px;
}

.cf-tot-val {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.cf-tot-val i {
    font-style: normal;
    font-size: 14px;
    font-weight: 500;
    color: var(--text2);
    margin-left: 4px;
}

.cf-tot-sub {
    font-size: 12px;
    color: var(--text3);
}

.cf-tot-net {
    border: 2px solid var(--primary);
}

.cf-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cf-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--card2);
    border: 1px solid var(--hairline);
    border-radius: 12px;
    gap: 20px;
}

.cf-item.cf-in {
    border-left: 3px solid var(--pos);
}

.cf-item.cf-out {
    border-left: 3px solid var(--neg);
}

.cf-item.cf-neutral {
    border-left: 3px solid var(--text3);
}

.cf-main {
    flex: 1;
    min-width: 0;
}

.cf-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.cf-amount {
    font-size: 18px;
    font-weight: 700;
}

.cf-amount i {
    font-style: normal;
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    margin-left: 4px;
}

.cf-amt-neutral {
    color: var(--text1);
}

.cf-method {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--bg);
}

.cf-m-cryptobot {
    color: #3b82f6;
}

.cf-m-xrocket {
    color: #8b5cf6;
}

.cf-m-card {
    color: #10b981;
}

.cf-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text2);
}

.cf-dot {
    color: var(--text3);
}

.cf-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.cf-tag {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text3);
}

.cf-usdt {
    font-size: 12px;
    color: var(--text2);
}

@media (max-width: 768px) {
    .cf-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cf-side {
        align-items: flex-start;
    }
}

/* ==========================================================================
   ОТКРЫТКА ВЛАДЕЛЬЦУ
   Показывается один раз после входа. Картинка портретная (560x934), поэтому
   ограничена и по ширине, и по высоте экрана: на ноутбуке без max-height она
   уезжала бы за нижний край вместе с кнопкой закрытия.
   ========================================================================== */
.owner-card-back {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(1, 4, 13, .82);
    backdrop-filter: blur(6px);
    animation: ownerCardIn .22s var(--ease);
}

@keyframes ownerCardIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.owner-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 340px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 18px;
    background: var(--card2);
    border: 1px solid var(--hairline-2);
    border-radius: var(--radius);
    box-shadow: var(--glow);
    text-align: center;
}

.owner-card-img {
    display: block;
    width: 100%;
    max-height: 46vh;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--hairline);
}

.owner-card-text {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.owner-card-text p { margin: 6px 0 0; }

.owner-card-title {
    color: var(--white);
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 2px;
}

.owner-card-ok { width: 100%; }

/* Крестик поверх картинки: она занимает почти всю карточку, и место под
   отдельную строку с кнопкой пришлось бы отнимать у изображения. */
.owner-card-x {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    color: var(--white);
    background: rgba(1, 4, 13, .55);
    border: 1px solid var(--hairline-2);
    border-radius: 50%;
    cursor: pointer;
    transition: background .15s var(--ease);
}

.owner-card-x:hover { background: rgba(1, 4, 13, .8); }

/* ===================== Профиль игрока (модалка) ===================== */
.pm-overlay {
    position: fixed; inset: 0; z-index: 100; display: none;
    align-items: flex-start; justify-content: center; padding: 40px 16px;
    background: rgba(1, 4, 13, .74);
    backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
    overflow-y: auto;
}
.pm-overlay.open { display: flex; animation: pmFade .18s var(--ease); }
@keyframes pmFade { from { opacity: 0; } to { opacity: 1; } }
.pm-modal {
    position: relative; width: 100%; max-width: 940px;
    background: linear-gradient(180deg, var(--card2), var(--card));
    border: 1px solid var(--hairline-2); border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
    padding: 26px 26px 30px; animation: pmRise .22s var(--ease);
}
@keyframes pmRise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.pm-close {
    position: absolute; top: 16px; right: 16px; width: 34px; height: 34px;
    border-radius: 10px; background: var(--btn); border: 1px solid var(--hairline-2);
    color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; z-index: 2;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.pm-close:hover { color: var(--white); background: var(--btn-hover); }

.pm-head {
    display: flex; gap: 18px; align-items: center; padding-right: 40px;
    padding-bottom: 20px; border-bottom: 1px solid var(--hairline);
    margin-bottom: 18px; flex-wrap: wrap;
}
.pm-avatar {
    width: 62px; height: 62px; flex: 0 0 62px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 800; color: #fff;
    background: var(--brand-grad); box-shadow: var(--brand-glow);
}
.pm-id { flex: 1 1 auto; min-width: 180px; }
.pm-name { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pm-meta { color: var(--muted); font-size: 13px; margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }
.pm-meta b.mono { color: var(--white); }
.pm-rank {
    font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
    background: rgba(60, 144, 255, .14); color: var(--brand-2);
    border: 1px solid rgba(60, 144, 255, .3); text-transform: uppercase; letter-spacing: .03em;
}
.pm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pm-tg {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px;
    border-radius: 11px; background: var(--brand-grad); color: #fff;
    font-weight: 600; font-size: 13px; text-decoration: none; box-shadow: var(--brand-glow);
}
.pm-btn {
    padding: 9px 14px; border-radius: 11px; background: var(--btn);
    border: 1px solid var(--hairline-2); color: var(--white);
    font-weight: 600; font-size: 13px; cursor: pointer; font-family: var(--font);
}
.pm-btn:hover { background: var(--btn-hover); }

.pm-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 10px; margin-bottom: 4px;
}
.pm-stat { background: var(--card); border: 1px solid var(--hairline); border-radius: 13px; padding: 13px 15px; }
.pm-stat .v { font-size: 19px; font-weight: 800; letter-spacing: -0.03em; }
.pm-stat .k { font-size: 11px; color: var(--muted2); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.pm-stat.pos .v { color: var(--ok); }
.pm-stat.neg .v { color: var(--err); }
.pm-stat.warn .v { color: var(--warn); }

.pm-sec { margin-top: 22px; }
.pm-sec > h3 {
    font-size: 12.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; color: var(--muted); margin-bottom: 11px;
}
.pm-note { font-size: 12px; color: var(--muted2); margin-top: 8px; line-height: 1.5; }
.pm-body .empty-state, .pm-body .loading { min-height: 200px; display: flex; align-items: center; justify-content: center; }
