/* Fonts Local Hosting (Variable Fonts) */
@font-face {
    font-family: "Jura";
    src: url("../fonts/Jura/Jura-VariableFont_wght.ttf") format("truetype");
    font-weight: 300 700;
    font-display: swap;
}

@font-face {
    font-family: "Manrope";
    src: url("../fonts/Manrope/Manrope-VariableFont_wght.ttf")
        format("truetype");
    font-weight: 200 800;
    font-display: swap;
}

@font-face {
    font-family: "Space Grotesk";
    src: url("../fonts/SpaceGrotesk/SpaceGrotesk-VariableFont_wght.ttf")
        format("truetype");
    font-weight: 300 700;
    font-display: swap;
}
:root {
    --bg-1: #0b1220;
    --bg-2: #020617;
    --bg-dark: #11141d;
    --fg: #e2e8f0;
    --fg-strong: #f8fafc;
    --fg-muted: #94a3b8;
    --muted: rgba(255, 255, 255, 0.06);
    --muted-2: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.1);
    --border-2: rgba(255, 255, 255, 0.2);
    --card: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.1);
    --accent-from: #f43f5e;
    --accent-to: #f59e0b;
    --accent-grad: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    --accent-grad-vert: linear-gradient(
        176.35deg,
        var(--accent-from),
        var(--accent-to)
    );
    --green: #22c55e;
    --green-2: #16a34a;
    --container: 80rem;
    --header-h: 56px;

    /* Updated Radius */
    --radius: 16px;
    --radius-btn: 12px;
    --radius-input: 12px;

    /* Fonts */
    --font-head:
        "Jura", "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
        "Apple Color Emoji", "Segoe UI Emoji";
    --font-body:
        "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
        sans-serif;

    --grid-o: 0.05; /* прозрачность сетки */
    color-scheme: dark;
    --formula-o: 0.1;
    --formula-color: #fff;
    --formula-blend: overlay;
    --grid-o: 0.05; /* базовая видимость в тёмной теме */
    --grid-color: rgba(255, 255, 255, 0.9); /* белые линии для тёмной темы */
    --grid-size: 32px;
}

[hidden] {
    display: none !important;
}

:root[data-theme="light"] {
    --grid-o: 0.1; /* делаем заметнее на светлом */
    --grid-color: rgba(2, 6, 23, 0.65);
    --bg-dark: #ffffff;
    --bg-1: #f6f7fb;
    --bg-2: #ffffff;
    --fg: #0b1220;
    --fg-strong: #020617;
    --fg-muted: #4b5563;
    --muted: rgba(0, 0, 0, 0.06);
    --muted-2: rgba(0, 0, 0, 0.08);
    --border: rgba(0, 0, 0, 0.1);
    --border-2: rgba(0, 0, 0, 0.2);
    --card: rgba(0, 0, 0, 0.04);
    --card-border: rgba(0, 0, 0, 0.08);
    --grid-o: 0.08;
    color-scheme: light;
    --formula-o: 0.16; /* чуть заметнее на светлом фоне */
    --formula-color: #334155; /* тёмно-серый вместо белого */
    --formula-blend: multiply; /* лучше «приклеивается» к светлому фону */
    --grid-o: 0.04;
}
#themeToggle svg {
    display: block;
}
#themeToggle .sun {
    display: none;
}
[data-theme="light"] #themeToggle .sun {
    display: block;
}
[data-theme="light"] #themeToggle .moon {
    display: none;
}
body,
.header,
.card,
.drawer__panel,
.modal__panel {
    transition:
        background-color 0.25s ease,
        color 0.25s ease,
        border-color 0.25s ease;
}
/* Стилизация скроллбара */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 10px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-from);
}

html,
body {
    overflow: auto;
    -ms-overflow-style: none; /* IE/старый Edge */
    scrollbar-width: none; /* Firefox */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none; /* Chrome/Safari/новый Edge */
}

/* Скрыть горизонтальный скролл у карусели */
.hscroll {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge legacy */
}
.hscroll::-webkit-scrollbar {
    /* Chrome/Safari/Edge */
    height: 0;
    display: none;
}
.hscroll::-webkit-scrollbar-track {
    background: transparent;
}
.hscroll::-webkit-scrollbar-thumb {
    background: transparent;
}
* {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
}
body {
    margin: 0;
    font-family: var(--font-body);
    background:
        radial-gradient(
            ellipse at top,
            rgba(244, 63, 94, 0.2),
            transparent 45%
        ),
        radial-gradient(
            ellipse at bottom,
            rgba(251, 191, 36, 0.2),
            transparent 50%
        ),
        linear-gradient(var(--bg-2), var(--bg-1) 55%, var(--bg-2));
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-top: var(--header-h);
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}
a {
    color: inherit;
    text-decoration: none;
}
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 16px;
}

/* GRID overlay */
.grid {
    opacity: var(--grid-o);
    background-image:
        linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: -1;
}

/* HEADER */
.header {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--header-h);
    z-index: 1000;
    backdrop-filter: saturate(1.1) blur(8px);
    background: color-mix(in oklab, var(--bg-2) 75%, transparent);
    border-bottom: 1px solid var(--border);
}
.header__inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: var(--fg-strong);
}
.brand__chip {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    color: var(--bg-1);
    background-image: linear-gradient(
        135deg,
        var(--accent-from),
        var(--accent-to)
    );
}
.brand__text {
    letter-spacing: 0.02em;
}
.nav {
    display: none;
    gap: 24px;
    color: color-mix(in oklab, var(--fg), #fff 5%);
}
.nav__link {
    font-size: 14px;
    transition: color 0.2s ease;
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-btn);
    padding: 10px 18px; /* Чуть шире */
    font-size: 15px;
    border: 1px solid transparent;
    cursor: pointer;
    color: var(--fg);
    transition: all 0.2s ease;
    font-weight: 600;
}
.btn--muted {
    background: var(--muted);
    border-color: var(--border);
}

.btn--accent {
    background-image: linear-gradient(
        90deg,
        var(--accent-from),
        var(--accent-to)
    );
    color: #0b1220;
    font-weight: 800;
    border: none;
    display: inline-flex; /* Fix flex alignment */
    justify-content: center;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
    font-family: var(--font-body);
}

.btn--icon-only {
    padding: 10px;
    width: 40px;
    height: 40px;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--muted);
}
.i {
    display: block;
}

/* DRAWER */
.drawer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    grid-template-columns: 1fr;
    pointer-events: none;
}
.drawer[hidden] {
    display: none;
}
.drawer__backdrop {
    grid-row: 1;
    grid-column: 1;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.2s;
}
.drawer__panel {
    grid-row: 1;
    grid-column: 1;
    justify-self: end;
    width: min(92vw, 360px);
    height: 100vh;
    background: var(--bg-1);
    border-left: 1px solid var(--border);
    transform: translateX(102%);
    transition: transform 0.28s;
    display: flex;
    flex-direction: column;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
.drawer--open .drawer__backdrop {
    opacity: 1;
    pointer-events: auto;
}
.drawer--open .drawer__panel {
    transform: translateX(0);
    pointer-events: auto;
}
.drawer__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    background: color-mix(in oklab, var(--bg-1) 92%, transparent);
    border-bottom: 1px solid var(--border);
}
.drawer__user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--muted-2);
    font-weight: 800;
}
.drawer__close {
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
}
.drawer__nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}
.drawer__link {
    padding: 12px;
    border-radius: 12px;
    background: var(--muted);
    border: 1px solid var(--border);
}

/* SIDE DOTS */
.side-nav {
    position: fixed;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900;
    display: none;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.side-nav__dot {
    position: relative;
    display: grid;
    place-items: center;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid color-mix(in oklab, #fff 20%, transparent);
    background: var(--muted);
    transition:
        transform 0.2s,
        background 0.2s;
}

.side-nav__dot.active {
    background-image: linear-gradient(
        90deg,
        var(--accent-from),
        var(--accent-to)
    );
    border-color: transparent;
}
.side-nav__dot::after {
    content: attr(data-label);
    position: absolute;
    right: 150%;
    white-space: nowrap;
    background: color-mix(in oklab, var(--bg-2) 90%, transparent);
    color: var(--fg);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    opacity: 0;
    transform: translateX(6px);
    pointer-events: none;
    transition:
        opacity 0.15s,
        transform 0.15s;
}
.side-nav__dot:hover::after {
    opacity: 1;
    transform: translateX(0);
}

/* HERO */
.hero {
    position: relative;
}
.hero__stage {
    position: sticky;
    top: 0;
    min-height: calc(var(--vh, 1vh) * 100);
    min-height: 100svh;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding-top: 28px;
}
.hero__inner {
    display: grid;
    gap: 18px;
    justify-items: center;
    padding-inline: 16px;
    padding-block: 64px;
}
.card--all {
    display: grid;
    place-items: center;
    text-align: center;
    gap: 10px;
    min-height: 220px; /* чтобы по высоте не отличалась */
}
.card--all .cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 14px;
    font-weight: 900;
    background-image: linear-gradient(
        90deg,
        var(--accent-from),
        var(--accent-to)
    );
    color: #0b1220;
    border: none;
}
.card--all .desc {
    font-size: 14px;
    color: var(--fg-muted);
}
.card--all svg {
    display: block;
}

.word {
    font-family: Roboto, Ubuntu, Cantarell, "Noto Sans", Helvetica, Arial;
    font-weight: 1000;
    line-height: 1;
    letter-spacing: -0.02em;
    text-align: center;
    font-size: 1000px; /* base, JS will fit */
    background-image: linear-gradient(
        90deg,
        var(--accent-from),
        var(--accent-to)
    );
    background-size: 200% 100%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.35));
    animation:
        breathe 4s ease-in-out infinite,
        gloss 3.5s ease-in-out infinite;
    white-space: nowrap;
    max-width: 100%;
}
@keyframes breathe {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}
@keyframes gloss {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.tagline {
    font-size: clamp(14px, 2.6vw, 18px);
    color: var(--fg-muted);
}

/* Formulas in HERO only */
.formulas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.1;
}
.formulas span {
    position: absolute;
    font-family:
        ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
        monospace;
    color: #fff;
    font-weight: 700;
    mix-blend-mode: overlay;
    opacity: 0.9;
    transform: rotate(var(--rot, 0deg));
    white-space: nowrap;
}
.formulas .f1 {
    left: 6%;
    top: 20%;
    font-size: 28px;
    --rot: -14deg;
}
.formulas .f2 {
    left: 64%;
    top: 18%;
    font-size: 22px;
    --rot: 8deg;
}
.formulas .f3 {
    left: 22%;
    top: 60%;
    font-size: 26px;
    --rot: -8deg;
}
.formulas .f4 {
    left: 72%;
    top: 64%;
    font-size: 24px;
    --rot: 12deg;
}
.formulas .f5 {
    left: 40%;
    top: 34%;
    font-size: 20px;
    --rot: -6deg;
}
.formulas .f6 {
    left: 12%;
    top: 72%;
    font-size: 18px;
    --rot: 5deg;
}
.formulas .f7 {
    left: 78%;
    top: 42%;
    font-size: 19px;
    --rot: -10deg;
}
.formulas .f8 {
    left: 52%;
    top: 76%;
    font-size: 17px;
    --rot: 7deg;
}
.formulas .f9 {
    left: 30%;
    top: 16%;
    font-size: 21px;
    --rot: -4deg;
}
.formulas .f10 {
    left: 86%;
    top: 28%;
    font-size: 18px;
    --rot: 9deg;
}

/* Sections */
.section {
    padding-block: 56px;
}
.kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    font-size: 12px;
    color: color-mix(in oklab, var(--fg), #fff 5%);
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--muted);
    width: max-content;
}
.section__title {
    font-size: clamp(22px, 3vw, 36px);
    color: var(--fg-strong);
    font-weight: 700;
    font-family: var(--font-head);
    margin: 8px 0;
}
.accent-bar {
    height: 4px;
    width: 110px;
    border-radius: 999px;
    background-image: linear-gradient(
        90deg,
        var(--accent-from),
        var(--accent-to)
    );
    margin-top: 6px;
    margin-bottom: 10px;
}
.lead {
    margin-top: 12px;
    color: color-mix(in oklab, var(--fg), #fff 5%);
    line-height: 1.75;
}

/* WHAT */
.what__title {
    font-family: var(--font-head);
    font-size: clamp(26px, 4.6vw, 40px);
    font-weight: 900;
    color: var(--fg-strong);
    margin: 6px 0;
}
.feature-card {
    display: flex;
    gap: 12px;
    align-items: center;
    background: color-mix(in oklab, var(--bg-1) 85%, transparent);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 12px 14px;
}
.feature-card + .feature-card {
    margin-top: 10px;
}
.feature-card__icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background-image: linear-gradient(
        135deg,
        var(--accent-from),
        var(--accent-to)
    );
}
.feature-card__title {
    font-weight: 700;
    color: var(--fg-strong);
    font-family: var(--font-head);
}
.feature-card__sub {
    font-size: 14px;
    color: color-mix(in oklab, var(--fg), #fff 10%);
}
.note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 12px;
    color: var(--fg-muted);
}
.note__icon {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--muted);
    border: 1px solid var(--border);
}

/* Horizontal tournaments */
.hscroll-wrap {
    position: relative;
}
.hscroll {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 85%;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-block: 6px;
}
.hscroll > * {
    scroll-snap-align: start;
}

.hscroll__controls {
    position: absolute;
    inset: auto 0 100% 0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-bottom: 8px;
}
.card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);

    /* Glass Effect */
    background: color-mix(in oklab, var(--bg-1) 85%, transparent);
    border: 1px solid var(--border);

    padding: 16px;
}
.card__topbar {
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background-image: linear-gradient(
        90deg,
        var(--accent-from),
        var(--accent-to)
    );
}
.card__head {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: color-mix(in oklab, var(--fg), #fff 5%);
}
.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
}
.status .dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    display: inline-block;
}
.status--soon {
    color: #fde68a;
    background: rgba(253, 230, 138, 0.1);
    border-color: rgba(253, 230, 138, 0.3);
}
.status--live {
    color: #86efac;
    background: rgba(134, 239, 172, 0.1);
    border-color: rgba(134, 239, 172, 0.3);
}
.status--ended {
    color: #cbd5e1;
    background: rgba(203, 213, 225, 0.08);
    border-color: rgba(203, 213, 225, 0.3);
}
.card__title {
    color: var(--fg-strong);
    font-weight: 800;
    font-size: 18px;
    margin: 0;
    font-family: var(--font-head);
}
.card__sub {
    margin: 4px 0 0;
    color: color-mix(in oklab, var(--fg), #fff 5%);
    font-size: 14px;
}
.card__meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    color: color-mix(in oklab, var(--fg), #fff 5%);
    font-size: 14px;
    flex-wrap: wrap;
}
.card__actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* TOP players (с круглыми номерами) */
.board {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: color-mix(in oklab, var(--bg-1) 85%, transparent);
    overflow: hidden;
}
.row {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    min-height: 89px;
}
.row:first-child {
    border-top: none;
}
/* кружки 1–3 как на скрине */
.rankchip {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-weight: 900;
    font-size: 18px;
    color: #0b1220;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.rankchip--1 {
    background-image: linear-gradient(135deg, #f59e0b, #fbbf24);
}
.rankchip--2 {
    background-image: linear-gradient(135deg, #e5e7eb, #94a3b8);
    color: #0f172a;
}
.rankchip--3 {
    background-image: linear-gradient(135deg, #f97316, #ea580c);
}
.rankchip--n {
    background: var(--muted);
    color: var(--fg);
}
/* аватар-инициалы */
.badge {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--muted);
    border: 1px solid var(--border);
    font-weight: 800;
    color: var(--fg-strong);
}
.row__mid {
    display: grid;
}
.row__name {
    font-weight: 900;
    color: var(--fg-strong);
}
.row__sub {
    font-size: 13px;
    color: color-mix(in oklab, var(--fg), #fff 10%);
}
.row__right {
    display: grid;
    gap: 4px;
    justify-items: end;
}
.score {
    padding: 10px 12px;
    border-radius: 14px;
    background: linear-gradient(
        135deg,
        color-mix(in oklab, var(--green) 22%, transparent),
        color-mix(in oklab, var(--green-2) 18%, transparent)
    );
    border: 1px solid color-mix(in oklab, var(--green) 40%, transparent);
    font-weight: 900;
    color: #d1fae5;
    min-width: 96px;
    text-align: center;
}
.wins {
    font-size: 13px;
    color: color-mix(in oklab, var(--fg), #fff 12%);
}
.topbar-btn {
    margin-left: auto;
    border: 1px solid var(--border);
    background: var(--muted);
    border-radius: 18px;
    padding: 8px 12px;
    color: color-mix(in oklab, var(--fg), #fff 6%);
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

/* FOOTER */
.footer {
    margin-top: 32px;
    border-top: 1px solid var(--border);
    background: color-mix(in oklab, var(--bg-2) 75%, transparent);
}
.footer__grid {
    display: grid;
    gap: 16px;
    padding: 24px 0;
    padding-left: 10px;
    padding-right: 10px;
}

.footer__brand {
    font-weight: 800;
    color: var(--fg-strong);
    font-size: 18px;
}
.footer__text {
    margin-top: 8px;
    color: var(--fg-muted);
    font-size: 14px;
}
.footer__links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
}
.footer__link {
    color: var(--fg);
    opacity: 0.9;
}
.footer__copy {
    margin-top: 10px;
    color: var(--fg-muted);
    font-size: 14px;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
}
.modal[hidden] {
    display: none;
}
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.2s;
}
.modal__panel {
    position: relative;
    width: min(92vw, 440px);
    border-radius: 16px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    padding: 16px;
    transform: translateY(10px);
    opacity: 0;
    transition:
        transform 0.2s,
        opacity 0.2s;
}
.modal--open .modal__backdrop {
    opacity: 1;
}
.modal--open .modal__panel {
    opacity: 1;
    transform: translateY(0);
}
.modal__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.modal__title {
    font-weight: 800;
    color: var(--fg-strong);
    font-size: 18px;
}
.modal__close {
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
}
.modal__body {
    display: grid;
    gap: 10px;
}
.modal__note {
    font-size: 12px;
    color: var(--fg-muted);
    margin-top: 6px;
}

/* Reveal */
[data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition:
        opacity 0.6s ease,
        transform 0.6s ease;
}
[data-reveal].in {
    opacity: 1;
    transform: translateY(0);
}
.formulas {
    opacity: var(--formula-o);
}
.formulas span {
    color: var(--formula-color);
    mix-blend-mode: var(--formula-blend);
}
@supports (-webkit-text-stroke: 1px black) {
    /* тонкий контур на светлой теме — ещё +читабельность */
    [data-theme="light"] .formulas span {
        -webkit-text-stroke: 0.4px rgba(0, 0, 0, 0.06);
    }
}

/* -------- 2) Контраст статусов (жёлтый/зелёный/серый) -------- */
[data-theme="light"] .status--soon {
    color: #a16207; /* тёмный янтарный (AA) */
    background: #fef3c7; /* светло-жёлтая подложка */
    border-color: #f59e0b33;
}
[data-theme="light"] .status--live {
    color: #166534; /* тёмный зелёный (AA) */
    background: #dcfce7; /* светло-зелёная подложка */
    border-color: #16a34a33;
}
[data-theme="light"] .status--ended {
    color: #374151; /* графитовый текст */
    background: #f3f4f6; /* нейтральная подложка */
    border-color: #94a3b833;
}

/* -------- 3) «Очки» в топе — сделать читаемыми на светлом -------- */
[data-theme="light"] .score {
    background: #bbf7d0; /* монолитная светло-зелёная, без градиента */
    color: #065f46; /* тёмный текст для контраста */
    border: 1px solid #34d399;
    text-shadow: none;
}

/* -------- 4) Нейтральные элементы (серые) чуть темнее -------- */
[data-theme="light"] .badge {
    background: #eef2f7;
    color: #0b1220;
    border-color: #cbd5e1;
}
[data-theme="light"] .board {
    border-color: #e5e7eb;
}
[data-theme="light"] .row {
    border-top-color: #e5e7eb;
}
/* Кнопка-плитка "Все турниры" — аккуратный вид */
.card--all {
    display: flex;
    justify-content: right;
    position: relative;
    display: grid;
    place-items: center; /* запас справа под стрелку */
    min-height: 200px; /* как у обычных карточек */
    width: 244px;
    padding-right: 80px;
    border-radius: 24px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background:
        radial-gradient(
            120% 120% at 0% 0%,
            rgba(255, 255, 255, 0.18),
            transparent 38%
        ),
        linear-gradient(
            135deg,
            var(--accent-from) 0%,
            #f97316 60%,
            var(--accent-to) 100%
        );
    color: #0b1220;
    transition:
        transform 0.15s ease,
        filter 0.15s ease;
}
.card--all .card__topbar {
    display: none;
}
.card--all .label {
    font-weight: 900;
    font-size: clamp(18px, 2.6vw, 22px);
    letter-spacing: 0.01em;
}
.card--all .arrow {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.92);
    color: #0b1220;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition:
        transform 0.15s ease,
        background 0.15s ease;
}

.card--all:active {
    transform: translateY(0) scale(0.98);
    filter: saturate(0.98);
}

/* корректировки для тёмной/светлой темы */
:root[data-theme="light"] .card--all {
    border-color: rgba(0, 0, 0, 0.08);
}
:root:not([data-theme="light"]) .card--all {
    border-color: rgba(255, 255, 255, 0.12);
}
:root {
    --btn-float: 2px; /* подъём при hover */
    --btn-press-bright: 0.98; /* затемнение при active */
    --btn-press-sat: 0.98;
}

/* Какие элементы считаем кнопками */
.btn,
.topbar-btn,
.drawer__link,
.drawer__close,
.modal__close,
#burger,
#drawerClose,
#modalClose {
    position: relative;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        filter 0.15s ease,
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
    will-change: transform, filter;
}

.btn:active,
.topbar-btn:active,
.drawer__link:active,
.drawer__close:active,
.modal__close:active,
#burger:active,
#drawerClose:active,
#modalClose:active,
.btn--hero:active {
    transform: translateY(0) scale(0.96) !important;
    filter: brightness(var(--btn-press-bright)) saturate(var(--btn-press-sat));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* Фокус-кольцо для клавиатуры */
.btn:focus-visible,
.topbar-btn:focus-visible,
.drawer__link:focus-visible,
.drawer__close:focus-visible,
.modal__close:focus-visible,
#burger:focus-visible,
#drawerClose:focus-visible,
#modalClose:focus-visible,
.btn--hero:focus-visible {
    outline: 3px solid color-mix(in oklab, #fff 75%, var(--accent-to));
    outline-offset: 2px;
    border-color: transparent;
}
/* Уважение prefers-reduced-motion — делаем движения мягче */

/* герой-зона занимает экран МИНУС фиксированный хэдэр */
.hero__stage {
    position: sticky;
    top: 0;
    min-height: 100svh;
    margin-top: -55px;
    display: grid;
    place-items: center;
    padding: 0;
}

/* внутренний контейнер — компактные отступы и центр текста */
.hero__inner {
    display: grid;
    gap: 16px;
    justify-items: center;
    text-align: center;
    padding: clamp(12px, 3vw, 24px);
    margin: 0 auto;
    max-width: min(1100px, 100% - 32px);
}
/* hero-кнопка: сочный градиент, мягкая тень, блик */
.btn--hero {
    position: relative;
    border: none;
    padding: 14px 28px;
    border-radius: 999px;
    font-weight: 900;
    background-image: linear-gradient(
        90deg,
        var(--accent-from),
        var(--accent-to)
    );
    color: #0b1220;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        filter 0.15s ease;
    margin-top: 20px;
}
.btn--hero::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.28),
        transparent 42%
    );
    pointer-events: none;
}

/* ===== Drawer 2.0 ===== */
.drawer__panel {
    background: color-mix(in oklab, var(--bg-1) 92%, transparent);
}
/* верхняя плашка с мягкой линией */
.drawer__top {
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--bg-1) 96%, transparent);
}

/* usercard c градиентным кольцом */
.drawer__usercard {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}
.avatar--ring {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--muted);
}
.avatar--ring::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(
        from 180deg,
        var(--accent-from),
        var(--accent-to)
    );
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 2px;
}
.user-meta {
    display: grid;
    line-height: 1.2;
}
.user-name {
    font-weight: 800;
    color: var(--fg-strong);
}
.user-role {
    font-size: 12px;
    color: var(--fg-muted);
}

/* группы меню */
.drawer__group {
    padding: 10px 16px;
}
.drawer__label {
    font-size: 12px;
    color: var(--fg-muted);
    margin: 0 0 8px 2px;
}

/* пункт меню как мини-карточка */
.drawer__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--muted);
    border: 1px solid var(--border);
    transition:
        transform 0.14s ease,
        background 0.14s ease,
        box-shadow 0.14s ease;
}
.drawer__item + .drawer__item {
    margin-top: 10px;
}

.drawer__item:active {
    transform: translateY(0) scale(0.99);
}
.drawer__item .left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.drawer__item .ico {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #0b1220;
    background-image: linear-gradient(
        135deg,
        var(--accent-from),
        var(--accent-to)
    );
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.5);
}
.drawer__item .chev {
    opacity: 0.7;
}

/* нижние экшены */
.drawer__actions {
    padding: 8px 16px 16px;
    display: grid;
    gap: 10px;
    margin: auto 0;
}
.btn--block {
    width: 100%;
    justify-content: center;
}

/* тоньше скролл у панели, без полос на iOS */
.drawer__panel {
    overscroll-behavior: contain;
}
/* 1) Панель без прокрутки и полос */
.drawer__panel {
    height: 100svh;
    max-height: 100svh;
    overflow: hidden; /* убираем скролл внутри панели */
    scrollbar-width: none;
}
.drawer__panel::-webkit-scrollbar {
    display: none;
}

/* 2) Топ меню: юзер слева, иконки справа */
.drawer__top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--bg-1) 96%, transparent);
}
.drawer__usercard {
    flex: 1;
    padding: 0;
} /* тянем влево */
.drawer__right {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 3) Прячем «Навигация» */
.drawer__label {
    display: none;
}

/* 4) Иконка темы как в хедере */
#themeToggleDrawerIcon svg {
    display: block;
}
#themeToggleDrawerIcon .sun {
    display: none;
}
[data-theme="light"] #themeToggleDrawerIcon .sun {
    display: block;
}
[data-theme="light"] #themeToggleDrawerIcon .moon {
    display: none;
}

/* 5) На всякий случай — убрать скролл у самого списка */
.drawer__nav {
    overflow: hidden;
}

/* (необязательно) если оставалась нижняя кнопка темы — скрыть */
.drawer__actions [data-role="theme-btn"] {
    display: none;
}
/* Тюним открытие/закрытие */
:root {
    --tr-open: cubic-bezier(0.22, 1, 0.36, 1);
    --tr-close: cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer__panel {
    transform: translateX(102%);
    transition:
        transform 0.34s var(--tr-open),
        opacity 0.2s ease;
}
.drawer__backdrop {
    opacity: 0;
    transition: opacity 0.22s ease;
}

/* открыто */
.drawer--open .drawer__panel {
    transform: translateX(0);
    opacity: 1;
}
.drawer--open .drawer__backdrop {
    opacity: 1;
}

/* плавное закрытие (отдельный тайминг) */
.drawer--closing .drawer__panel {
    transform: translateX(102%);
    transition:
        transform 0.3s var(--tr-close),
        opacity 0.2s ease;
}
.drawer--closing .drawer__backdrop {
    opacity: 0;
}

/* прячем верхнюю кнопку "Полный рейтинг" в секции #top */
#top .topbar-btn {
    display: none;
}
/* CTA внизу рейтинга — в стилистике списка */
.row--cta {
    /* как обычная строка */
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
    gap: 0;
    padding: 12px 14px; /* как у .row */
    min-height: 72px; /* ~высота строки с бейджами */
    border-top: 1px solid var(--border);
    background: transparent; /* без заливки-полосы */
    max-height: 81px;
}

/* внутренняя "кнопка" */
.row--cta .chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 999px;
    font-weight: 900;
    letter-spacing: 0.01em;
    background-image: linear-gradient(
        135deg,
        var(--accent-from),
        var(--accent-to)
    );
    color: #0b1220;
    box-shadow:
        0 10px 22px rgba(0, 0, 0, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
    transition:
        transform 0.15s ease,
        filter 0.15s ease,
        box-shadow 0.15s ease;
}

/* кружок со стрелкой — как у "Все турниры" */
.row--cta .arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        0 2px 8px rgba(0, 0, 0, 0.18);
}
:root:not([data-theme="light"]) .row--cta .arrow {
    background: rgba(255, 255, 255, 0.92);
    color: #0b1220;
}
:root[data-theme="light"] .row--cta .arrow {
    background: rgba(255, 255, 255, 0.92);
    color: #0b1220;
}

/* ховер/нажатие — такие же жесты, как у остальных кнопок */
.row--cta:hover .chip {
    transform: translateY(-2px);
    filter: saturate(1.05);
    box-shadow:
        0 14px 30px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
    color: #fff;
}
.row--cta:active .chip {
    transform: translateY(0) scale(0.99);
    filter: brightness(0.98);
}

/* безопасность для маленьких экранов — пусть "пилюля" не выходит за края */

/* не двигаем всю строку CTA */
.row--cta,
.row--cta:hover,
.row--cta:active {
    transform: none !important;
}

/* анимация только у самой кнопки внутри */
.row--cta .chip {
    transition:
        transform 0.15s ease,
        filter 0.15s ease,
        box-shadow 0.15s ease;
    will-change: transform;
}
.row--cta:hover .chip {
    transform: translateY(-2px);
    filter: saturate(1.05);
    box-shadow:
        0 14px 30px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.row--cta:active .chip {
    transform: translateY(0) scale(0.99);
    filter: brightness(0.98);
}

/* ===== Qubit extras: modals/forms/checkbox/links/disabled/eyes & drawer flash fix ===== */
:root {
    --field-bg-dark: rgba(255, 255, 255, 0.08);
    --field-bg-light: rgba(255, 255, 255, 0.78);
    --field-br: 12px;
    --ring: color-mix(in oklab, #fff 75%, var(--accent-to));
}

/* =========================================
   7. WORKSPACE LAYOUT
   ========================================= */

#workspace-view {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
/* SIDEBAR */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar__brand {
    padding: 24px 24px 40px; /* More space bottom */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Updated Brand Text */
/* Brand Text - Global */
.brand__text {
    font-family: "Space Grotesk", sans-serif;
    font-size: 20px;
    font-weight: 300;
    line-height: 28px;
    color: var(--fg-strong);
    letter-spacing: 0;
}

.sidebar__nav {
    padding: 0 24px; /* Align with brand */
    display: flex;
    flex-direction: column;
    gap: 12px; /* Increased gap */
}

/* Updated Nav Item */
/* Updated Nav Item */
.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 52px;
    padding: 10px 16px;
    gap: 16px;
    border-radius: 16px;

    font-family:
        system-ui,
        -apple-system,
        sans-serif;
    font-size: 16px;
    color: #888899;
    font-weight: 500;

    transition: all 0.2s ease;
    border: 1px solid transparent;
    z-index: 0;
}

/* Inactive Hover: Full Gradient Fill, White Text, Lift */

.nav-item:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.05);
}

/* Active State: Gradient Border (Mask), Gradient Text */
/* Active State: Gradient Border (Mask), Gradient Text, Background Fill */
.nav-item.active {
    background: linear-gradient(
        176.35deg,
        rgba(244, 63, 94, 0.1),
        rgba(245, 158, 11, 0.1)
    );
    color: transparent; /* Gradient text via background-clip on children */
    border: 1px solid transparent; /* Handled by ::before */
}

/* Active Gradient Border Mask */
.nav-item.active::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(176.35deg, #f43f5e, #f59e0b);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
}

/* Active Text & Icon Gradient */
.nav-item.active span,
.nav-item.active i,
.nav-item.active .icon-svg {
    background: linear-gradient(176.35deg, #f43f5e, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent; /* Fallback */
}

.nav-item.active .icon-svg {
    fill: url(#navGradient) !important;
    background: none;
    background-clip: border-box;
    -webkit-text-fill-color: initial;
    color: initial;
}

/* Theme toggle */
.theme-toggle-ws {
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    background: var(--muted);
    border: 1px solid var(--border);
    color: var(--fg-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-toggle-ws:active {
    transform: scale(0.94);
    filter: brightness(1.1);
}
.theme-toggle-ws svg {
    display: block;
}
.theme-toggle-ws .sun {
    display: none;
}
[data-theme="light"] .theme-toggle-ws .sun {
    display: block;
}
[data-theme="light"] .theme-toggle-ws .moon {
    display: none;
}

/* CONTENT AREA */
.workspace__content {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 32px 40px;
}

/* DASHBOARD GRID */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    grid-template-rows: auto auto;
}

/* Top Row: Active Tournament (2 cols) | Profile (1 col) */
.dash-cell--large {
    grid-column: span 2;
}

/* WIDGETS */
.widget {
    background: var(--card); /* Slightly lighter than bg */
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.widget__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.widget__title {
    font-size: 16px;
    font-weight: 500;
    color: var(--fg-muted);
}

.widget__subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: var(--fg-muted);
    opacity: 0.7;
}

/* Active Tournament Specifics from screenshot */
.tournament-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: auto;
    margin-bottom: 24px;
}
.stat-box {
    background: var(--muted);
    border-radius: 12px; /* Inner boxes */
    padding: 16px;
    text-align: center;
}
.stat-box__label {
    font-size: 12px;
    color: var(--fg-muted);
    margin-bottom: 4px;
}
.stat-box__value {
    font-size: 20px;
    font-weight: 700;
    color: var(--fg-strong);
}
.stat-box__value--accent {
    color: var(--green); /* e.g. +3 rank */
    font-size: 12px;
    font-weight: 500;
}

/* Profile Widget */
.profile-head {
    display: flex;
    gap: 16px;
    align-items: center;
}
.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    object-fit: cover;
}
.profile-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--fg-strong);
}
.profile-tag {
    font-size: 13px;
    color: var(--fg-muted);
}

.profile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
    margin-bottom: 24px;
}
.p-stat {
    background: var(--muted);
    border-radius: 12px;
    padding: 12px;
}
.p-stat__label {
    font-size: 11px;
    color: var(--fg-muted);
}
.p-stat__val {
    font-size: 16px;
    font-weight: 600;
    color: var(--fg-strong);
    margin-top: 2px;
}

/* Bottom Row Widgets */
.task-widget {
    background:
        radial-gradient(
            circle at top right,
            rgba(255, 255, 255, 0.03),
            transparent 40%
        ),
        var(--card);
}
.task-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--muted);
    display: grid;
    place-items: center;
    margin: auto;
    border: 1px solid var(--border);
}
.task-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

/* Charts Placeholder */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 100px;
    margin-top: auto;
}
.bar {
    /* flex: 1; */
    background: var(--muted);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
}
.bar.active {
    background: linear-gradient(to top, var(--accent-from), var(--accent-to));
}

/* Drawer flash fix: overlay below panel, panel no fade */
.drawer__backdrop {
    z-index: 1;
    opacity: 0;
    transition: opacity 0.22s ease;
}
.drawer__panel {
    z-index: 2;
    opacity: 1;
    transition: transform 0.34s var(--tr-open, ease);
}
.drawer--open .drawer__backdrop {
    opacity: 0.5;
}
.drawer--open .drawer__panel {
    transform: translateX(0);
}

/* Modal panel: only slide, no initial dim */
.modal__panel {
    opacity: 1;
    transition: transform 0.28s var(--tr-open, ease);
}
.modal .modal__panel {
    transform: translateY(16px);
}
.modal--open .modal__panel {
    transform: translateY(0);
}

/* Forms */
.modal__form {
    display: grid;
    gap: 12px;
}
.field {
    display: grid;
    gap: 6px;
}
.field label {
    font-size: 13px;
    color: var(--fg-muted);
}
.input,
.textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--field-br);
    border: 1px solid var(--border);
    color: var(--fg);
    /* kak bilo nado */
    background: var(--muted);
    outline: none;
    transition:
        box-shadow 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}

.textarea {
    resize: none; /* Auto-expand via JS */
    padding-bottom: 24px; /* Space for counter */
}

/* Character Counter */
.char-counter {
    font-size: 11px;
    color: var(--fg-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}
.char-counter.limit {
    color: var(--accent-from);
    font-weight: 700;
}

:root[data-theme="light"] .input,
:root[data-theme="light"] .textarea {
    background: var(--field-bg-light);
    border-color: rgba(0, 0, 0, 0.08);
}
.input::placeholder {
    color: color-mix(in oklab, var(--fg), #fff 30%);
    opacity: 0.85;
}
:root[data-theme="light"] .input::placeholder {
    color: color-mix(in oklab, var(--fg), #000 20%);
}
.input:focus {
    box-shadow: 0 0 0 3px var(--ring);
    border-color: transparent;
}
.error {
    font-size: 12px;
    color: #fecaca;
    min-height: 1em;
}
:root[data-theme="light"] .error {
    color: #b91c1c;
}

/* Checkbox with gradient */
.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--fg);
}
.checkbox input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--muted);
    display: grid;
    place-items: center;
    outline: none;
    cursor: pointer;
    transition:
        filter 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease,
        transform 0.15s ease;
}
.checkbox input:active {
    transform: scale(0.98);
}
.checkbox input:checked {
    border-color: transparent;
    background-image: linear-gradient(
        135deg,
        var(--accent-from),
        var(--accent-to)
    );
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.checkbox input:checked::after {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 1);
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="black" d="M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"/></svg>')
        center/contain no-repeat;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="black" d="M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"/></svg>')
        center/contain no-repeat;
}

/* Buttons disabled (grey) until valid */
.btn.is-disabled,
.btn:disabled {
    filter: none;
    background: var(--muted) !important;
    color: color-mix(in oklab, var(--fg), #000 15%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 0 transparent !important;
    cursor: not-allowed;
}

/* Links row — компактные текстовые */
.form__links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 10px;
    font-size: 13px;
}
.form__links a {
    color: color-mix(in oklab, var(--fg), #fff 8%);
    text-decoration: none;
}
.form__links a:hover {
    color: var(--fg-strong);
    text-decoration: underline;
}

/* Password visibility toggle */
.input-group {
    position: relative;
}
.input-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--muted);
    border: 1px solid var(--border);
    color: var(--fg);
}
.input-toggle svg {
    display: block;
}
.input-toggle:hover {
    filter: brightness(1.05);
    border-color: linear-gradient(
        176.35deg,
        rgba(244, 63, 94, 0.1),
        rgba(245, 158, 11, 0.1) 100%
    );
}
.input-toggle:active {
    transform: translateY(-50%) scale(0.98);
}

/* Code inputs 8x (XXXX-XXXX) */
.code-grid {
    display: grid;
    grid-template-columns: repeat(4, 42px) 24px repeat(4, 42px);
    gap: 8px;
    align-items: center;
    justify-content: center;
}
.team-code-grid {
    grid-template-columns: repeat(10, 42px);
}
.code-cell {
    width: 42px;
    height: 48px;
    padding: 0;
    text-align: center;
    font-weight: 900;
    font-size: 25px;
    font-family: var(--font-head);
    letter-spacing: 0.02em;
}

/* Premium Prefix styling */
.code-cell--prefix {
    background: linear-gradient(
        176.35deg,
        var(--accent-from),
        var(--accent-to)
    );
    color: #fff;
    border-radius: 12px;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.35);
    user-select: none;
    line-height: 1; /* Reset for flex centering */
}

.code-sep {
    text-align: center;
    color: var(--fg-muted);
    user-select: none;
}

/* ===== FIX v3 — 2025‑10‑05 ===== */

/* Белая стрелка внутри любых градиентных кнопок */
.btn--accent svg,
.btn--accent svg path {
    color: #fff;
    stroke: #fff;
    fill: #fff;
}

/* Глазик в одной сетке с полем — не «едет», легко кликается */
.field.input-group {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
}
.field.input-group label {
    grid-column: 1 / -1;
}
.field.input-group .input {
    grid-row: 2;
    grid-column: 1;
    padding-right: 12px;
}
.field.input-group .input-toggle {
    grid-row: 2;
    grid-column: 2;
    position: relative; /* Для ::before */
    z-index: 0; /* Контекст наложения */
    top: auto; /* Сброс top: 50% */
    right: auto; /* Сброс right: 10px */
    transform: none;
    margin-left: 10px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;

    /* Base style (Inactive) */
    background: var(--muted);
    border: 1px solid var(--border);
    color: var(--fg-muted);
    cursor: pointer;

    /* Material Symbols font settings */
    font-family: "Material Symbols Outlined";
    font-weight: 300;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    transition: all 0.2s ease;
}

/* Span внутри toggle для градиентного текста */
.input-toggle span {
    display: inline-block;
    color: currentColor;
    transition: color 0.2s ease;
}

/* --- STATES --- */

/* 1. HOVER (Любое состояние) - Яркий фон, белая иконка */

/* 2. ACTIVE (Открыт, покой) - Прозрачный центр, яркая рамка */
.input-toggle.is-active {
    border: 1px solid transparent;
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.25);
    color: transparent; /* Текст градиентный через span */
}

.input-toggle.is-active:not(:hover) {
    background: linear-gradient(
            176.35deg,
            rgba(244, 63, 94, 0.1),
            rgba(245, 158, 11, 0.1)
        )
        padding-box !important;
}

:root[data-theme="light"] .input-toggle.is-active:not(:hover) {
    background: linear-gradient(
            176.35deg,
            rgba(244, 63, 94, 0.2),
            rgba(245, 158, 11, 0.2)
        )
        padding-box !important;
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.35);
}

/* FIX: На мобиле при клике (active) цвет не должен слетать */
.input-toggle.is-active:active span,
.input-toggle.is-active:focus span {
    background: linear-gradient(
        176.35deg,
        rgba(244, 63, 94, 1),
        rgba(245, 158, 11, 1)
    ) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
}

/* Рамка через псевдо-элемент */
.input-toggle.is-active::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(176.35deg, #f43f5e, #f59e0b);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
}

/* Градиентный текст иконки (только в покое) */
.input-toggle.is-active:not(:hover) span {
    background: linear-gradient(
        176.35deg,
        rgba(244, 63, 94, 1),
        rgba(245, 158, 11, 1)
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.input-toggle:active {
    transform: scale(0.96);
}

/* Подписи об ошибках под паролями */
.field [data-error-for="pass"],
.field [data-error-for="pass2"] {
    margin-top: 4px;
    min-height: 1em;
}

/* Кнопки по умолчанию серые (disabled) */
.btn.is-disabled,
.btn:disabled {
    filter: none;
    background: var(--muted) !important;
    color: color-mix(in oklab, var(--fg), #000 15%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 0 transparent !important;
    cursor: not-allowed;
}

/* Модалки: панель без «вспышки» затемнения, только слайд */
.modal .modal__panel {
    transform: translateY(14px);
    opacity: 1;
}
.modal--open .modal__panel {
    transform: translateY(0);
}

/* Вход по коду — не вылезает ни текст, ни кнопка */
#codeModal .modal__panel {
    max-width: min(600px, 96vw);
    padding: 16px 18px;
}
.code-grid {
    justify-content: center;
}

/* Drag‑scroll для карусели + без выделения текста при перетаскивании */
.hscroll {
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
}
.hscroll.dragging {
    cursor: grabbing;
}
.hscroll * {
    user-select: none;
    -webkit-user-drag: none;
}

.modal__panel--code {
    width: auto;
}

.btn-nav {
    background-image: linear-gradient(
        135deg,
        var(--accent-from),
        var(--accent-to)
    );
    margin-top: 20px !important;
}

/* =========================================
   6. RESEND BUTTON & MOBILE FIXES (325px)
   ========================================= */

.btn--resend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--muted);
    border: 1px solid var(--border);
    color: var(--fg-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: not-allowed;
    transition: all 0.2s ease;
    padding: 10px 14px;
    border-radius: 12px;
}

.btn--resend.is-active {
    background-image: linear-gradient(
        90deg,
        var(--accent-from),
        var(--accent-to)
    );
    color: #fff;
    cursor: pointer;
    border: none;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.verify__note {
    margin-top: 0 !important;
}

.hscroll > * {
    scroll-snap-align: center; /* Центрируем, чтобы не было жесткой привязки к левому краю */
}

/* Valid input glowing state (matches .input-toggle.is-active) */
.input.is-valid {
    border: 1px solid transparent !important;
    background:
        linear-gradient(
                176.35deg,
                rgba(244, 63, 94, 0.1),
                rgba(245, 158, 11, 0.1)
            )
            padding-box,
        linear-gradient(var(--bg-1), var(--bg-1)) padding-box,
        linear-gradient(176.35deg, #f43f5e, #f59e0b) border-box !important;
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.25);
    background-origin: border-box;
}

/* Fix for light mode (shadow visibility) */
:root[data-theme="light"] .input.is-valid {
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.35);
    background:
        linear-gradient(
                176.35deg,
                rgba(244, 63, 94, 0.2),
                rgba(245, 158, 11, 0.2)
            )
            padding-box,
        linear-gradient(var(--bg-1), var(--bg-1)) padding-box,
        linear-gradient(176.35deg, #f43f5e, #f59e0b) border-box !important;
}

.reg-link {
    text-decoration: none;
    border-bottom: 1px solid;
    border-image: linear-gradient(
            176.35deg,
            rgba(244, 63, 94, 1),
            rgba(245, 158, 11, 1)
        )
        1;
    background-image: linear-gradient(
        176.35deg,
        rgba(244, 63, 94, 1),
        rgba(245, 158, 11, 1)
    ) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
}

/* Fix sidebar theme toggle icon positioning when collapsed/active */
.sidebar .sidebar__footer .input-toggle {
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================
   DASHBOARD STYLES
   ========================================= */

/* Main Layout */
.workspace__content {
    margin-left: 260px;
    padding: 20px 24px;
    padding-top: 10px; /* Reduced top padding */
    min-height: 100vh;
    position: relative;
    background: transparent;
}
.dash-view {
    max-width: 1200px;
    margin: 0 auto;
}
.dash-header {
    font-family: var(--font-head);
    font-size: 32px;
    font-weight: 300;
    color: var(--fg-strong);
    margin-bottom: 24px;
    margin-top: 0;
}

/* Grid Layout */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: 24px;
}

/* CARDS Shared */
.dash-card {
    background: #11141d; /* Deep Dark */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
:root[data-theme="light"] .dash-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.tour-card .card__head {
    margin-bottom: 16px;
    height: 48px;
    gap: 0;
}
.tour-card .card__title {
    font-family: var(--font-head);
    font-size: 18px; /* Smaller, cleaner */
    font-weight: 800;
    color: white;
}

:root[data-theme="light"] .tour-card .card__title {
    color: black;
}

.tour-card .card__sub {
    font-size: 14px;
    color: var(--fg-muted);
    margin-top: 0px;
}
.text-accent-icon {
    fill: url(#navGradient) !important;
    color: transparent;
}
.text-accent {
    color: #fff;
    background: linear-gradient(90deg, #f43f5e, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}
.text-green {
    color: #10b981 !important;
}
.row-between {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* 1. Active Tournament */
.tour-card {
    grid-column: span 2;
    background: linear-gradient(
        169.22deg,
        rgba(244, 63, 94, 0.2),
        rgba(245, 158, 11, 0.2) 100%
    );
}
:root[data-theme="light"] .tour-card {
    background: linear-gradient(
        169.22deg,
        rgba(244, 63, 94, 0.2),
        rgba(245, 158, 11, 0.2) 100%
    );
}
.tour-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px; /* More space before button */
    flex: 1;
}
.stat-box {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: auto; /* Taller */
}
:root[data-theme="light"] .stat-box {
    background: rgba(0, 0, 0, 0.03);
}

.stat-box__label {
    font-size: 13px;
    color: var(--fg-muted);
    margin-bottom: 8px;
}
.stat-box__val {
    font-family: var(--font-head);
    font-size: 32px;
    font-weight: 500;
    color: var(--fg-strong);
    line-height: 1;
    margin-bottom: 6px;
}
.stat-box__sub {
    font-size: 12px;
    color: var(--fg-muted);
}

.btn--gradient-block {
    width: 100%;
    border-radius: 16px;
    padding: 16px;
    background: linear-gradient(90deg, #f43f5e, #f59e0b);
    color: white;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.4);
    transition:
        transform 0.2s,
        box-shadow 0.2s;
}
.btn--gradient-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(244, 63, 94, 0.5);
}

/* 2. Profile Card */
.profile-card {
    grid-column: span 1;
}
.profile-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}
.profile-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}
.metric {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px 12px;
}
:root[data-theme="light"] .metric {
    background: rgba(0, 0, 0, 0.03);
}

.metric__label {
    font-size: 11px;
    color: var(--fg-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.metric__val {
    font-size: 20px;
    color: var(--fg-strong);
    font-weight: 500;
    font-family: var(--font-head);
}
.profile-actions {
    display: grid;
    gap: 12px;
    margin-top: auto;
}

.btn--subtle {
    background: rgba(255, 255, 255, 0.05);
    color: var(--fg-muted);
    border: none;
    padding: 14px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    justify-content: center;
}
:root[data-theme="light"] .btn--subtle {
    background: rgba(0, 0, 0, 0.05);
}

/* 3. Daily Task */
.task-card {
    grid-column: span 1;
}

.task-card .card__head {
    height: 56px;
    gap: 4px;
}

.task-card .card__sub {
    color: rgba(136, 136, 153, 255);
}

.task-title-large {
    font-family: var(--font-head);
    font-size: 24px;
    color: var(--fg-strong);
    font-weight: 800;
    margin-top: 8px;
    line-height: 1.2;
}
.task-circle-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}
.dash-card .task-circle {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        rgba(244, 63, 94, 0.1),
        rgba(245, 158, 11, 0.1)
    );
    border: 0;
    display: grid;
    place-items: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    position: relative;
}
:root[data-theme="light"] .task-circle {
    background: linear-gradient(
        135deg,
        rgba(244, 63, 94, 0.2),
        rgba(245, 158, 11, 0.2)
    );
    box-shadow: 0 10px 40px rgba(244, 63, 94, 0.15);
}
.task-circle::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        rgba(244, 63, 94, 0.3),
        rgba(245, 158, 11, 0.1)
    );
    z-index: -1;
    opacity: 0.5;
}
:root[data-theme="light"] .task-circle::after {
    display: none;
}
.task-code-icon {
    font-size: 60px !important;
    font-weight: 300;
    line-height: 60px !important;
    transition: all 0.3s ease;
    fill: url(#navGradient) !important;
}

/* Hover effects for Task Card */
.task-card:hover .task-circle {
    transform: translateY(-8px);
    background: linear-gradient(
        135deg,
        rgba(244, 63, 94, 1),
        rgba(245, 158, 11, 1)
    );
    box-shadow: 0 12px 30px rgba(244, 63, 94, 0.4);
}

.task-card:hover .task-code-icon {
    fill: #fff !important;
    transform: scale(1.1);
}

.task-card {
    transition: border-color 0.3s ease;
}

.task-card:hover {
    border-color: rgba(244, 63, 94, 0.3);
}

.task-circle {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.task-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chip-dark {
    background: #2a1018; /* Dark red bg */
    border: 1px solid #5a1020;
    color: #f43f5e;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
:root[data-theme="light"] .chip-dark {
    background: rgba(244, 63, 94, 0.1);
    border: none;
}

/* 4. Rating Chart */
/* 4. Rating Chart */
.chart-card {
    grid-column: span 1;
}
.chart-area {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 190px;
    margin-top: auto;
    padding: 40px 0 10px;
}
.chart-col {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    flex: 1;
    height: 100%;
    min-width: 0;
    position: relative;
    cursor: pointer;
}
.bar-val {
    font-size: 13px;
    font-weight: 800;
    font-family: var(--font-head);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    transform: translateY(10px);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    display: grid;
    place-items: center;
    min-height: 18px;
    pointer-events: none; /* Чтобы не мешало ховеру на баре */
}

.bar-val span {
    grid-area: 1/1; /* Stack them */
    background: linear-gradient(135deg, #f43f5e, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bar-val .val-secondary {
    opacity: 0;
    transform: translateY(10px);
}

.chart-col:hover .bar-val.has-toggle .val-primary {
    opacity: 0;
    transform: translateY(-10px);
}
.chart-col:hover .bar-val.has-toggle .val-secondary {
    opacity: 1;
    transform: translateY(0);
}

.bar-lbl {
    font-size: 11px;
    color: var(--fg-muted);
    margin-top: 8px;
    font-weight: 600;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bar {
    width: 100%;
    /* 20% opaque base */
    background: linear-gradient(
        180deg,
        rgba(244, 63, 94, 0.2) 0%,
        rgba(245, 158, 11, 0.05) 100%
    );
    border-radius: 8px;
    transition:
        height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1),
        background 0.3s ease,
        box-shadow 0.3s ease;
    position: relative;
}

/* Active / Hover State */
.chart-col.is-active .bar-val,
.chart-col:hover .bar-val {
    opacity: 1;
    transform: translateY(0);
}

.chart-col.is-active .bar {
    /* 100% opaque for active */
    background: linear-gradient(
        180deg,
        rgba(244, 63, 94, 1) 0%,
        rgba(245, 158, 11, 1) 100%
    );
    box-shadow: 0 10px 25px rgba(244, 63, 94, 0.2);
}

.chart-col:not(.is-active):hover .bar {
    /* Slightly more on hover */
    background: linear-gradient(
        180deg,
        rgba(244, 63, 94, 0.4) 0%,
        rgba(245, 158, 11, 0.1) 100%
    );
}

/* Light theme overrides */
:root[data-theme="light"] .chart-col:not(.is-active) .bar {
    background: linear-gradient(
        180deg,
        rgba(244, 63, 94, 0.2),
        rgba(245, 158, 11, 0.05)
    );
}

/* 5. Pulse Chart */
.pulse-card {
    grid-column: span 1;
}
.metric-chart .bar {
    min-width: 6px;
    border-radius: 4px;
}
.pulse-foot {
    margin-top: 20px;
    font-size: 13px;
    color: var(--fg-muted);
}

/* MOBILE HEADER */
.workspace-mobile-header {
    display: none !important; /* Force hide on desktop */
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    backdrop-filter: saturate(1.1) blur(8px);
    background: color-mix(in oklab, var(--bg-2) 75%, transparent);
    border-bottom: 1px solid var(--border);
    width: 100%; /* Ensure full width */
    height: var(--header-height);
}
.workspace-mobile-header .brand__text {
    display: block !important;
}

/* RESPONSIVE */

/* =========================================
   TOURNAMENTS VIEW STYLES
   ========================================= */

.tour-view {
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.tour-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.search-wrap {
    position: relative;
    width: 100%;
    max-width: 320px;
}

.search-input {
    width: 100%;
    background: color-mix(in oklab, var(--bg-1) 85%, transparent);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 16px 10px 40px;
    color: var(--fg-strong);
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: transparent;
    background: linear-gradient(
        176.35deg,
        rgba(244, 63, 94, 0.1),
        rgba(245, 158, 11, 0.1)
    );
}

.search-wrap::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 13px; /* Radius input + border */
    padding: 1px;
    background: linear-gradient(176.35deg, #f43f5e, #f59e0b);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-wrap:focus-within::before {
    opacity: 1;
}

.search-wrap:focus-within .search-input {
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.15);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fg-muted);
    font-size: 20px;
}

/* Tabs */
.tour-filters-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 1001; /* Выше чем карточки турниров */
}

.tabs-nav {
    display: flex;
    gap: 32px; /* Wider gap like in photo */
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    margin-bottom: 32px;
}

.tab-item {
    font-size: 15px;
    color: var(--fg-muted);
    cursor: pointer;
    position: relative;
    padding: 0 4px 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.tab-item .icon {
    font-size: 20px;
    color: inherit;
    transition: inherit;
}

.tab-item:hover {
    background: linear-gradient(176.35deg, #f43f5e, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent; /* Main text is white,*/
}

.tab-item.active {
    background: linear-gradient(90deg, #f43f5e, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tab-item.active .icon,
.tab-item.active .icon-svg,
.tab-item:hover .icon,
.tab-item:hover .icon-svg {
    fill: url(#navGradient) !important;
}

.tab-item.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f43f5e, #f59e0b);
    box-shadow: 0 0 16px rgba(244, 63, 94, 0.4);
    border-radius: 4px 4px 0 0;
}

/* Chips Row */
.chips-row {
    display: grid;
    grid-template-columns: 1fr auto; /* Chips take rest, icons stay right */
    align-items: flex-start;
    gap: 16px;
    width: 100%;
}

.chips-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap; /* Allow wrapping again as requested */
    flex: 1;
    min-width: 0;
}

.chip-btn {
    padding: 6px 16px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--fg-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chip-btn.active {
    background: linear-gradient(90deg, #f43f5e, #f59e0b);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.chip-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.15);
}

.action-btns {
    display: flex;
    gap: 8px;
    flex-shrink: 0; /* Never shrink icons */
}

.btn--icon-only {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--fg-muted);
}

.btn--icon-only:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--fg-strong);
}

/* Tournament Card List */
.tour-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1; /* Базовый слой для карточек */
}

.tour-more-action {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

.btn--more {
    width: 100%;
    max-width: 320px;
    justify-content: center;
    border-radius: 16px !important;
    font-weight: 500;
    font-size: 15px !important;
    padding: 14px !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

.btn--more:active {
    transform: translateY(0) scale(0.97) !important;
    filter: brightness(0.9);
}

.tournament-card {
    background: #11141d;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition:
        transform 0.3s ease,
        border-color 0.3s ease;
}

.tournament-card:hover {
    transform: translateY(-2px);
    border-color: rgba(244, 63, 94, 0.2);
}

.tournament-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f43f5e, #f59e0b);
    opacity: 0.8;
}

.tour-card__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Состояния */
.status--live {
    color: #10b981;
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}
.status--live .status-dot {
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
    animation: pulse-dot 2s infinite;
}

.status--upcoming {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
}
.status--upcoming .status-dot {
    background: #f59e0b;
}

.status--ended {
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.2);
}
.status--ended .status-dot {
    background: #f43f5e;
}

@keyframes pulse-dot {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.6;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Светлая тема */
:root[data-theme="light"] .status-tag {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}
:root[data-theme="light"] .status--live {
    background: #dcfce7;
    color: #15803d;
}
:root[data-theme="light"] .status--upcoming {
    background: #fef3c7;
    color: #b45309;
}
:root[data-theme="light"] .status--ended {
    background: #fee2e2;
    color: #b91c1c;
}

.participants-count {
    font-size: 12px;
    color: var(--fg-muted);
}

.tour-card__content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tour-card__title {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 400;
    color: var(--fg-strong);
}

.tour-card__desc {
    font-size: 14px;
    color: var(--fg-muted);
    line-height: 1.5;
}

.tour-card__divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 4px 0;
}

.tour-card__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tour-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fg-muted);
    font-size: 13px;
}

.tour-meta-item .icon-svg {
    font-size: 18px;
}

.btn--join {
    background: linear-gradient(90deg, #f43f5e, #f59e0b);
    color: white;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn--join:active {
    transform: scale(0.96);
    filter: brightness(0.9);
}

.btn--outline-tour {
    background: transparent;
    border: 2px solid #f59e0b;
    color: #f59e0b;
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn--outline-tour:active {
    transform: scale(0.96);
    background: #d97706;
}

.btn--outline-tour .icon-svg {
    font-size: 22px;
}

.btn--muted-tour {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--fg-muted);
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn--muted-tour:active {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0.98);
}

/* Light Theme Overrides */
:root[data-theme="light"] .search-input {
    background: #ffffff;
    border-color: #e5e7eb;
}

:root[data-theme="light"] .search-wrap:focus-within .search-input {
    background: linear-gradient(
        176.35deg,
        rgba(244, 63, 94, 0.2),
        rgba(245, 158, 11, 0.2)
    );
}

:root[data-theme="light"] .tabs-nav {
    border-color: #e5e7eb;
}
:root[data-theme="light"] .chip-btn {
    background: #f5f5f7;
    border-color: #e5e7eb;
    color: #4b5563;
}
:root[data-theme="light"] .chip-btn.active {
    background: linear-gradient(90deg, #f43f5e, #f59e0b);
    color: #ffffff;
    border-color: transparent;
}
:root[data-theme="light"] .btn--icon-only {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #4b5563;
}
:root[data-theme="light"] .btn--icon-only:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}
:root[data-theme="light"] .tournament-card {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}
:root[data-theme="light"] .tour-card__divider {
    background: #e5e7eb;
}
:root[data-theme="light"] .btn--muted-tour {
    background: #f5f5f7;
    border-color: #e5e7eb;
}

/* Popover System */
.tour-popover {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: #1a1e29;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    display: none;
    animation: fadeInScale 0.2s ease-out;
    min-width: 272px;
}

.tour-popover.visible {
    display: block;
}

.tour-popover--left {
    right: auto;
    left: 0;
}

.popover-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-strong);
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.popover-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.popover-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--fg-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    position: relative; /* Для позиционирования подсказки */

    /* Запрещаем выделение текста и вызов системного меню на мобилках */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Подсказка при зажатии (Tooltip) */
.popover-item::after {
    content: attr(data-full);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: #1e2533;
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.popover-item:active::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}

:root[data-theme="light"] .popover-item::after {
    background: #ffffff;
    color: #11141d;
    border-color: #e5e7eb;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.popover-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popover-item:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}

.popover-item.active {
    background: linear-gradient(90deg, #f43f5e, #f59e0b);
    color: white !important;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.2);
}

/* Internal search in popovers */
.popover-search-wrap {
    margin-bottom: 12px;
}

.popover-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--fg-strong);
    outline: none;
}

.popover-search:focus {
    border-color: #f43f5e;
}

.popover-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
}

.btn-reset-link {
    background: none;
    border: none;
    color: #f43f5e;
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
    transition: opacity 0.2s;
}

.btn-reset-link:hover {
    opacity: 0.8;
}

.popover-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden; /* Убираем боковой скролл */
    padding-right: 8px;
}

.popover-grid::-webkit-scrollbar {
    width: 4px;
}
.popover-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Calendar Styling */
.calendar-popover {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 12px;
    background: #1a1e29;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 280px;
}

.calendar-popover.visible {
    display: block;
    animation: fadeInScale 0.2s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day-label {
    font-size: 11px;
    color: var(--fg-muted);
    text-align: center;
    padding-bottom: 8px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.cal-day:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.1);
}
.cal-day.active {
    background: linear-gradient(90deg, #f43f5e, #f59e0b) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(244, 63, 94, 0.3);
}
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.cal-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-strong);
}

.cal-nav {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: var(--fg-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    transition: all 0.2s;
}

.cal-nav:active {
    transform: scale(0.9);
}

.cal-nav .icon-svg {
    font-size: 20px;
}

.cal-day.empty {
    cursor: default;
    pointer-events: none;
}

.cal-day.today {
    border: 1px solid #f43f5e;
    color: #f43f5e;
}

:root[data-theme="light"] .calendar-popover {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}
:root[data-theme="light"] .tour-popover {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}
:root[data-theme="light"] .popover-item:hover {
    background: #f5f5f7;
}
:root[data-theme="light"] .popover-title {
    border-bottom-color: #e5e7eb;
}

.card__foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card__foot .icon-text {
    display: flex;
    align-items: center;
    gap: 4px;
}
.card__foot .icon-text .span:last-child {
    color: rgba(255, 255, 255, 255);
    font-family: Roboto;
    font-style: Light;
    font-size: 18px;
    font-weight: 300;
    line-height: 28px;
    letter-spacing: 0px;
}
.card__foot .icon-text .fire {
    fill: url(#navGradient) !important;
    background: none !important;
    color: transparent !important;
    -webkit-text-fill-color: initial !important;
    background-clip: border-box !important;
    font-style: normal;
    font-size: 24px !important;
    font-weight: 300;
    line-height: 28px;
    letter-spacing: 0px;
    display: inline-block;
    vertical-align: middle;
}

/* =========================================
   ANIMATIONS & TOOLTIPS
   ========================================= */

/* Custom Tooltip disabled (using bar-val instead) */
.chart-col {
    position: relative;
    cursor: pointer;
}
.chart-col:hover .bar {
    filter: brightness(1.2);
}

/* Animations */
@keyframes growBar {
    from {
        height: 0;
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.chart-col .bar {
    animation: growBar 1s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
/* Stagger animations for bars */
.chart-col:nth-child(1) .bar {
    animation-delay: 0.1s;
}
.chart-col:nth-child(2) .bar {
    animation-delay: 0.15s;
}
.chart-col:nth-child(3) .bar {
    animation-delay: 0.2s;
}
.chart-col:nth-child(4) .bar {
    animation-delay: 0.25s;
}
.chart-col:nth-child(5) .bar {
    animation-delay: 0.3s;
}
.chart-col:nth-child(6) .bar {
    animation-delay: 0.35s;
}
.chart-col:nth-child(7) .bar {
    animation-delay: 0.4s;
}
.chart-col:nth-child(8) .bar {
    animation-delay: 0.45s;
}

/* Pulse Breath Animation */
@keyframes pulseBreath {
    0%,
    100% {
        opacity: 1;
        transform: scaleY(1);
    }
    50% {
        opacity: 0.8;
        transform: scaleY(0.95);
    }
}
.metric-chart .chart-col.is-active .bar {
    animation:
        growBar 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) backwards,
        pulseBreath 3s infinite ease-in-out 1s; /* Start breathing after grow */
}

/* Dashboard Entry Animations */
[data-view-anim] {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.6s ease,
        transform 0.6s ease;
}
[data-view-anim].in {
    opacity: 1;
    transform: translateY(0);
}

#workspace-view[hidden] .workspace-mobile-header {
    display: none !important;
}

#tournaments .card__head {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

/* =========================================
   LOADER & 404 PAGE
   ========================================= */

/* Global Loader Overlay */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: #0b0d11;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.5s ease,
        visibility 0.5s ease;
}

.loader-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

#app {
    transition: opacity 0.4s ease;
}

.loader-overlay[hidden] {
    display: none; /* Fallback for legacy app logic */
}

/* Rolling Cube Animation */
.cube-wrapper {
    width: 60px;
    height: 60px;
    position: relative;
    perspective: 200px;
}

.cube {
    width: 40px;
    height: 40px;
    position: absolute;
    bottom: 0;
    left: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    background-size: 200% 200%;
    box-shadow: 0 10px 30px rgba(244, 63, 94, 0.4);
    animation:
        cubeRoll 1.2s infinite ease-in-out,
        cubeShimmer 2s infinite linear;
}

@keyframes cubeRoll {
    0% {
        transform: rotate(0deg);
        left: 0;
    }
    25% {
        transform: rotate(90deg);
        left: 20px;
    }
    50% {
        transform: rotate(180deg);
        left: 40px;
    }
    75% {
        transform: rotate(270deg);
        left: 20px;
    }
    100% {
        transform: rotate(360deg);
        left: 0;
    }
}

@keyframes cubeShimmer {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.loader-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--fg-strong);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.8;
    animation: pulseText 1.5s infinite ease-in-out;
}

@keyframes pulseText {
    0%,
    100% {
        opacity: 0.4;
        transform: scale(0.98);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

body.loading {
    overflow: hidden;
}

/* 404 Page Styles */
.error-page {
    background: var(--bg);
    color: var(--fg);
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    position: relative;
}

.error-content {
    max-width: 500px;
    padding: 24px;
    z-index: 10;
}

.error-cube-container {
    width: 140px;
    height: 140px;
    margin: 0 auto 40px;
    display: grid;
    place-items: center;
}

.error-cube {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    border-radius: 24px;
    display: grid;
    place-items: center;
    font-size: 32px;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 20px 50px rgba(244, 63, 94, 0.3);
    position: relative;
    animation: glitchCube 3s infinite;
}

@keyframes glitchCube {
    0%,
    100% {
        transform: rotate(0) scale(1);
    }
    30% {
        transform: rotate(5deg) scale(1.05);
        filter: hue-rotate(15deg);
    }
    35% {
        transform: rotate(-3deg) scale(0.98);
    }
    70% {
        transform: rotate(-5deg) scale(1.02);
        filter: hue-rotate(-10deg);
    }
}

.error-title {
    font-size: clamp(24px, 5vw, 42px);
    font-weight: 900;
    margin-bottom: 12px;
    background: linear-gradient(to right, #fff, var(--fg-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.error-subtitle {
    font-size: 16px;
    color: var(--fg-muted);
    margin-bottom: 32px;
    line-height: 1.6;
}

.decor-cube {
    position: absolute;
    background: var(--muted);
    border-radius: 8px;
    opacity: 0.05;
    z-index: 1;
}

.decor-1 {
    width: 100px;
    height: 100px;
    top: 10%;
    left: 10%;
    transform: rotate(15deg);
}
.decor-2 {
    width: 150px;
    height: 150px;
    bottom: 15%;
    right: 10%;
    transform: rotate(-10deg);
}
.decor-3 {
    width: 60px;
    height: 60px;
    top: 60%;
    left: 15%;
    transform: rotate(45deg);
}

/* =========================================
   TOAST NOTIFICATION SYSTEM
   ========================================= */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 360px;
    background: rgba(26, 30, 41, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--accent-from);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 16px;
    transform: translateX(120%);
    transition:
        transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.4s ease;
    opacity: 0;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast__icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-from);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.toast__content {
    flex-grow: 1;
}

.toast__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-strong);
    margin-bottom: 2px;
}

.toast__desc {
    font-size: 12px;
    color: var(--fg-muted);
    line-height: 1.4;
}

/* Toast States */
.toast--success {
    border-left-color: #10b981;
}
.toast--success .toast__icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.toast--error {
    border-left-color: #f43f5e;
}
.toast--error .toast__icon {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
}

.toast--info {
    border-left-color: #3b82f6;
}
.toast--info .toast__icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* ========================================= */
/*      CONSOLIDATED MEDIA QUERIES         */
/* ========================================= */

@media (prefers-contrast: more) {
    .grid {
        opacity: calc(var(--grid-o) + 0.05);
    }
}
@media (hover: hover) {
    .nav__link:hover {
        color: var(--fg-strong);
    }

    .btn--muted:hover {
        background: var(--muted-2);
    }

    .btn--accent:hover {
        filter: brightness(1.1);
        transform: translateY(-1px);
        box-shadow: 0 6px 16px rgba(244, 63, 94, 0.5);
    }
    .btn--accent:active {
        transform: translateY(0);
    }

    .drawer__link:hover {
        background: var(--muted-2);
    }

    .side-nav__dot:hover {
        transform: scale(1.1);
    }

    .card--all:hover {
        filter: brightness(1.05);
        color: #fff;
    }

    .card--all:hover {
        transform: translateY(-2px);
        filter: brightness(1.05); /* Added back for consistency */
    }
    .card--all:hover .arrow {
        transform: translate(2px, -50%);
    }

    .btn:hover,
    .topbar-btn:hover,
    .drawer__link:hover,
    .drawer__close:hover,
    .modal__close:hover,
    #burger:hover,
    #drawerClose:hover,
    #modalClose:hover {
        transform: translateY(calc(-1 * var(--btn-float)));
        color: #fff !important;
        background-image: linear-gradient(
            90deg,
            var(--accent-from),
            var(--accent-to)
        ) !important;
    }
    .btn--accent:hover {
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
        filter: saturate(1.05);
    }
    .btn--muted:hover,
    .drawer__link:hover,
    .topbar-btn:hover {
        box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
        filter: brightness(1.03);
    }
    .btn--icon-only:hover,
    .drawer__close:hover,
    .modal__close:hover,
    #burger:hover {
        transform: translateY(calc(-0.6 * var(--btn-float))) scale(1.02);
    }
    .modal__close:hover {
        background: linear-gradient(176.35deg, #f43f5e, #f59e0b) !important;
    }
    .btn--hero:hover {
        transform: translateY(-2px);
        filter: saturate(1.05);
        box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
    }

    .drawer__item:hover {
        transform: translateY(-2px);
        background: var(--muted-2);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
    }
    .drawer__item:hover .chev {
        transform: translateX(2px);
    }

    .nav-item:hover:not(.active) {
        background: linear-gradient(
            135deg,
            var(--accent-from),
            var(--accent-to)
        );
        color: #fff;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
        border-color: transparent;
    }
    .nav-item:hover:not(.active) .icon-svg {
        color: #fff;
        font-variation-settings:
            "FILL" 1,
            "wght" 300,
            "GRAD" 0,
            "opsz" 24;
    }

    .theme-toggle-ws:hover {
        color: var(--fg);
        background: var(--muted-2);
        transform: translateY(-1px);
    }

    .btn-nav:hover {
        background-image: linear-gradient(
            135deg,
            var(--accent-from),
            var(--accent-to)
        );
        color: #fff;
    }

    /* 1. HOVER (Любое состояние) - Яркий фон, белая иконка */
    .input-toggle:hover,
    .input-toggle.is-active:hover,
    .input-toggle:focus:hover {
        border-color: transparent;
        background: linear-gradient(
                176.35deg,
                rgba(244, 63, 94, 1),
                rgba(245, 158, 11, 1)
            )
            padding-box !important;
        box-shadow: 0 0 16px rgba(244, 63, 94, 0.4);
        color: #fff !important;
    }
    .input-toggle:hover span,
    .input-toggle.is-active:hover span,
    .input-toggle:focus:hover span {
        background: none !important;
        -webkit-text-fill-color: #fff !important;
        color: #fff !important;
        transform: scale(1.05);
    }

    .tab-item:hover:not(.active) {
        color: var(--fg-strong);
        opacity: 0.8;
    }

    .chip-btn:hover:not(.active) {
        background: linear-gradient(90deg, #f43f5e, #f59e0b);
        color: white;
    }

    .btn--more:hover {
        background: linear-gradient(90deg, #f43f5e, #f59e0b) !important;
        color: white !important;
        border-color: transparent !important;
        box-shadow: 0 8px 20px rgba(244, 63, 94, 0.2) !important;
        transform: translateY(-2px);
    }

    .btn--join:hover {
        box-shadow: 0 4px 15px rgba(244, 63, 94, 0.4);
        transform: scale(1.02);
    }

    .btn--outline-tour:hover {
        background: #f59e0b;
        color: #11141d;
        border-color: transparent;
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
        transform: translateY(-2px);
    }

    .btn--muted-tour:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .popover-item:hover {
        background: rgba(255, 255, 255, 0.05);
        color: var(--fg-strong);
    }

    .cal-day:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .cal-nav:hover {
        background: rgba(255, 255, 255, 0.08);
        color: var(--fg-strong);
    }
}
@media (min-width: 992px) {
    .nav {
        display: flex;
    }
}
@media (min-width: 1400px) {
    .side-nav {
        display: flex;
        right: 24px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .word {
        animation: none;
    }

    .btn,
    .topbar-btn,
    .drawer__link,
    .drawer__close,
    .modal__close,
    #burger,
    #drawerClose,
    #modalClose {
        transition-duration: 0.05s;
    }
    .btn:hover,
    .topbar-btn:hover,
    .drawer__link:hover,
    .drawer__close:hover,
    .modal__close:hover,
    #burger:hover,
    #drawerClose:hover,
    #modalClose:hover {
        transform: translateY(-1px);
    }

    .drawer__panel,
    .drawer__backdrop {
        transition: none !important;
    }
}
@media (min-width: 640px) {
    .hscroll {
        grid-auto-columns: 50%;
    }

    .footer__grid {
        grid-template-columns: 1fr 1fr;
    }
}
@media (min-width: 1200px) {
    .hscroll {
        grid-auto-columns: 33.333%;
    }
}
@media (max-width: 640px) {
    .hero__inner {
        gap: 12px;
    }
}
@media (max-width: 400px) {
    h2.section__title.in {
        width: 200px;
    }

    #codeModal .modal__panel {
        width: 96vw;
        padding: 12px;
    }
    .code-grid {
        grid-template-columns: repeat(4, 32px) 12px repeat(4, 32px);
        gap: 6px;
    }
    .code-cell {
        width: 32px;
        height: 38px;
        line-height: 38px;
        font-size: 18px;
    }
}
@media (max-width: 480px) {
    .row--cta .chip {
        width: 100%;
        justify-content: center;
    }

    .code-grid {
        grid-template-columns: repeat(4, 38px) 22px repeat(4, 38px);
        gap: 6px;
    }
    .code-cell {
        width: 38px;
        height: 46px;
        line-height: 46px;
    }

    .toast-container {
        top: auto;
        bottom: 100px; /* Над мобильной навигацией */
        left: 16px;
        right: 16px;
    }
    .toast {
        min-width: 0;
        width: 100%;
    }
}
@media (max-width: 1088px) {
    .tour-popover {
        position: absolute !important;
        top: calc(100% + 12px) !important;
        bottom: auto !important;
        left: auto !important; /* Will be set by modifier */
        right: auto !important; /* Will be set by modifier */
        max-width: calc(100vw - 32px) !important;
        transform: none !important;
        margin: 0 !important;
        z-index: 1000;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
        padding: 12px !important;
    }

    .tour-popover * {
        box-sizing: border-box !important;
    }

    .tour-popover--right {
        right: 0 !important;
        left: auto !important;
    }
    .tour-popover--left {
        left: 0 !important;
        right: auto !important;
    }
    /* .sidebar {
        width: 80px;
    } */
    .sidebar__brand .brand__text,
    .sidebar__nav span:last-child {
        display: none;
    }
    .workspace__content {
        width: calc(100% - 80px);
    }
    .dash-grid {
        grid-template-columns: 1fr;
    }
    .dash-cell--large {
        grid-column: auto;
    }

    .dash-grid {
        grid-template-columns: 1fr 1fr;
    }
    .tour-card {
        grid-column: span 2;
    }
    .profile-card {
        grid-column: span 1;
    }
    .task-card {
        grid-column: span 1;
    }
    .chart-card {
        grid-column: span 1;
    }
    .pulse-card {
        grid-column: span 1;
    }

    .workspace__content {
        padding: 24px;
    }
}
@media (max-width: 420px) {
    .code-grid {
        grid-template-columns: repeat(4, 36px) 18px repeat(4, 36px);
        gap: 6px;
    }
    .code-cell {
        width: 36px;
        height: 44px;
        line-height: 44px;
    }
}
@media (max-width: 350px) {
    #codeModal .modal__panel {
        width: 96vw;
        padding: 10px;
    }
    .code-grid {
        grid-template-columns: repeat(4, 30px) 10px repeat(4, 30px);
        gap: 5px;
    }
    .code-cell {
        width: 30px;
        height: 36px;
        line-height: 36px;
        font-size: 17px;
    }

    /* Адаптация сетки кода под узкие экраны */
    .code-grid {
        gap: 3px !important;
        grid-template-columns: repeat(4, 1fr) 8px repeat(4, 1fr) !important;
    }
    .code-cell {
        width: auto !important; /* тянемся */
        min-width: 24px;
        height: 36px;
        font-size: 16px;
        padding: 0;
    }
    #codeModal .modal__panel,
    #verifyModal .modal__panel {
        padding: 12px 10px;
    }
    .modal__panel {
        width: 95vw !important;
    }
    /* Кнопки тоже чуть компактнее */
    .btn {
        padding: 10px 10px;
        font-size: 14px;
    }
    .brand__text {
        display: none; /* Скрываем текст бренда если совсем узко, оставляем лого */
    }
    .header__actions {
        gap: 8px;
    }
    .section__title {
        font-size: 20px;
    }

    .tabs-nav {
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-right: 20px;
        padding-left: 2px;
    }
    .tabs-nav::-webkit-scrollbar {
        display: none;
    }
    .tab-item {
        flex-shrink: 0;
    }

    /* Small screens adjustment for filters */
    .chips-row {
        gap: 8px !important;
    }
    .action-btns {
        gap: 4px !important;
    }
    .chip-btn {
        padding: 5px 12px !important;
        font-size: 12px !important;
    }
    .btn--icon-only {
        padding: 0 !important;
        justify-content: center;
    }

    .chips-list {
        padding-bottom: 4px;
    }
    .chips-list::-webkit-scrollbar {
        display: none;
    }
    .chip-btn {
        flex-shrink: 0;
    }
}
@media (max-width: 768px) {
    .team-invite-card {
        border-radius: 24px;
        padding: 24px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
    }
    .invite-icon-box {
        margin: 0 auto;
    }
    .invite-actions {
        width: 100%;
        justify-content: center;
        gap: 12px;
    }
    .invite-actions .btn {
        flex: 1;
        padding: 12px 16px !important;
    }

    .sidebar__brand .brand__text,
    .sidebar__nav span:last-child {
        display: inline-block;
    }
    .sidebar__nav .nav-item {
        justify-content: start;
        padding: 0;
    }
    .nav-item {
        padding: 10px 16px !important;
    }
    .sidebar__nav {
        padding: 0 24px;
    }
    .sidebar__brand {
        flex-direction: row;
    }
    .sidebar__brand .brand {
        margin-bottom: 0;
    }

    .workspace-mobile-header {
        display: flex !important; /* Show on mobile */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        height: 56px;
    }
    #workspace-view {
        display: inline !important;
        padding-top: var(--header-height) !important;
    }

    .workspace__content {
        margin-left: 0 !important; /* FORCE RESET MARGIN */
        padding-top: 72px; /* Add bottom padding for scroll */
        width: 100%;
    }
    .dash-view {
        padding: 0;
        max-width: 100%;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2000;
        background: var(--bg-1);
        width: 280px;
        position: fixed; /* Ensure fixed */
        top: 0;
        left: 0;
        bottom: 0;
    }
    .sidebar.visible {
        transform: translateX(0);
        box-shadow: 10px 0 50px rgba(0, 0, 0, 0.5);
    }
    .workspace__content:has(.sidebar.visible) {
        /* затемнение */
        filter: blur(2px);
    }
    .dash-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .dash-header {
        font-size: 28px;
        margin-bottom: 16px;
    }
    .stat-box {
        padding: 12px;
        height: auto;
        min-height: 100px;
    }

    .tour-head-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .search-wrap {
        max-width: 100%;
    }
    .tour-card__title {
        font-size: 18px;
    }
    .tour-card__bottom {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .btn--join,
    .btn--outline-tour,
    .btn--muted-tour {
        justify-content: center;
    }

    /* Fix popovers on mobile - Restore relative positioning */
    .tour-popover,
    .calendar-popover {
        position: absolute !important;
        top: calc(100% + 12px) !important;
        left: auto !important;
        right: auto !important;
        max-width: calc(100vw - 32px) !important;
        transform: none !important;
        z-index: 2000;
        margin: 0 !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
    }

    .tour-popover--right,
    .calendar-popover--right {
        right: 0 !important;
        left: auto !important;
    }
    .tour-popover--left,
    .calendar-popover--left {
        left: 0 !important;
        right: auto !important;
    }

    .calendar-popover {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        position: static !important;
    }

    .cal-grid {
        display: grid !important;
        grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
        gap: 0px !important;
        margin-top: 4px !important;
        width: 100% !important;
    }

    .cal-day {
        font-size: 11px !important;
        height: 28px !important;
        width: 100% !important;
        aspect-ratio: auto !important;
        border-radius: 6px;
    }

    .cal-day-label {
        font-size: 10px !important;
        padding-bottom: 2px !important;
        font-weight: 500 !important;
        opacity: 0.6;
    }

    .popover-title {
        font-size: 13px !important;
        padding-bottom: 6px !important;
        margin-bottom: 6px !important;
        font-weight: 600 !important;
    }

    .popover-item {
        padding: 6px 10px;
        font-size: 12px;
    }

    .popover-footer {
        margin-top: 6px !important;
        padding-top: 6px !important;
    }

    /* Календарный подзаголовок (Январь 2026) */
    .cal-header {
        margin-bottom: 12px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .cal-title {
        font-size: 13px !important;
        font-weight: 600 !important;
    }

    .cal-nav {
        background: none !important;
        border: none !important;
        color: var(--fg-muted) !important;
        cursor: pointer !important;
        padding: 4px !important;
        display: flex !important;
        align-items: center !important;
    }

    .cal-nav .icon-svg {
        font-size: 18px !important;
    }

    .calendar-popover > div:first-child {
        margin-bottom: 0px !important;
    }
}
@media (max-width: 600px) {
    #workspace-content
        > div.dash-view
        > div
        > div.card.dash-card.tour-card.in
        > div.tour-stats {
        grid-template-columns: 1fr;
    }
}

/* TEAM VIEW */
.team-view {
    padding-bottom: 40px;
    padding-top: 0;
    max-width: 1200px;
    margin: 0 auto;
}

.team-tabs {
    display: flex;
    gap: 32px;
    margin-top: 8px;
    border-bottom: 1px solid var(--border);
}

/* Icons in tabs specific handling if needed */
.tab-item .icon {
    -webkit-background-clip: text;
    background-clip: text;
    font-family: Material Symbols Outlined;
    font-style: Regular;
    font-size: 20px;
    font-weight: 300;
    line-height: 28px;
    letter-spacing: 0px;
    text-align: left;
}

.tab-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.team-separator {
    height: 1px;
    background: var(--border); /* Match tabs border */
    margin-bottom: 12px;
    width: 100%;
}

/* GRADIENT BORDER UTILITY FOR CARDS */
.card-gradient-border {
    position: relative;
    background: var(--bg-1); /* Inner bg */
    background-clip: padding-box;
    border: 1px solid transparent;
    border-radius: 999px;
}
.card-gradient-border::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    margin: -1px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
}

/* Invite Card */
.team-invite-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px;
    margin: 32px 0 12px 0;
    width: 100%;
    position: relative;
    border-radius: 24px;
    background: linear-gradient(
        90deg,
        rgba(244, 63, 94, 0.1) 0%,
        rgba(245, 158, 11, 0.1) 100%
    );
    border: none;
}

.team-invite-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 24px;
    padding: 1px;
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 1;
}

:root[data-theme="light"] .team-invite-card {
    background: linear-gradient(
        90deg,
        rgba(244, 63, 94, 0.2) 0%,
        rgba(245, 158, 11, 0.2) 100%
    );
}

.invite-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 16px;
    background: linear-gradient(135deg, #f43f5e, #f59e0b);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: #000;
    box-shadow: 0 8px 20px rgba(244, 63, 94, 0.4);
}

.invite-icon-box .icon-svg {
    font-size: 26px;
    font-variation-settings:
        "FILL" 0,
        "wght" 400,
        "GRAD" 0,
        "opsz" 24;
}

.invite-content {
    flex: 1;
    min-width: 0;
}

.invite-title {
    color: var(--fg-strong);
    font-size: 16px;
    font-weight: 300;
    line-height: 24px;
    letter-spacing: 0px;
}

.invite-desc {
    font-size: 14px;
    font-weight: 300;
    line-height: 20px;
    letter-spacing: 0px;
    text-align: left;
    color: var(--fg-muted);
}

.invite-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .team-invite-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
        margin: 24px 0 12px 0;
    }

    .invite-actions {
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
    }
}

@media (max-width: 400px) {
    .invite-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .invite-actions .action-reject,
    .invite-actions .app-reject {
        order: 2;
        flex: 1;
    }
    .invite-actions .action-accept,
    .invite-actions .app-accept {
        order: 1;
        flex: 1;
    }
    .invite-actions .action-report,
    .invite-actions .app-report {
        order: 3;
        flex: 0;
        width: auto;
    }
}

/* .team-invite-card .btn {
    padding: 12px 36px !important;
    font-weight: 400;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
} */

/* .team-invite-card .btn--muted {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    box-shadow: none !important;
} */

.team-section-title {
    font-size: 24px;
    font-weight: 400;
    color: #fff;
    margin-bottom: 16px;
}

.team-section-desc {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 32px;
}

/* Team Management Grid */
.team-section-head {
    margin-bottom: 24px;
}

.team-section-title {
    font-size: 24px;
    font-weight: 300; /* As per design, thin header */
    color: var(--fg-strong);
    margin: 0 0 8px 0;
}

.team-section-desc {
    color: var(--fg-muted);
    font-size: 15px;
    margin: 0;
    max-width: 600px;
    line-height: 1.5;
}

.team-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.team-action-card {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    align-items: flex-start;
    text-align: left; /* Let grid show? Or card bg */
    border: 1px solid var(--border);
    border-radius: 24px;
}

.action-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.action-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--fg-strong);
    margin: 0 0 8px 0;
}

.action-desc {
    font-size: 14px;
    color: var(--fg-muted);
    margin: 0 0 32px 0;
    line-height: 1.6;
    flex: 1;
}

.action-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(176.35deg, #f43f5e, #f59e0b);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: 0 8px 16px rgba(244, 63, 94, 0.2);
}

.action-icon-box span,
.action-icon-box .icon-svg {
    font-size: 24px;
    color: #000 !important;
    font-variation-settings:
        "FILL" 0,
        "wght" 400,
        "GRAD" 0,
        "opsz" 24;
}

/* Override generic utility classes for these specific boxes */
.action-icon-box.bg-accent-soft,
.action-icon-box.bg-orange-soft {
    border: none !important;
}

.btn--wide {
    width: 100%;
    justify-content: center;
    max-width: 160px;
    height: 44px;
    font-weight: 600;
}

.text-accent-link {
    background: linear-gradient(176.35deg, #f43f5e, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block; /* Чтобы работал transform */
    transition: all 0.3s ease; /* Добавим плавности */
}
.text-accent-link:hover {
    -webkit-text-fill-color: var(
        --fg-strong
    ); /* Сбрасываем прозрачность заливки */
    color: var(--fg-strong);
    transform: translateY(calc(-1 * var(--btn-float)));
}

/* SIDEBAR COLLAPSE SYSTEM */
@media (min-width: 769px) {
    .sidebar {
        transition: width 0.4s cubic-bezier(0.2, 0, 0, 1);
        overflow: hidden; /* Важно: скрываем всё, что не влезает */
        will-change: width;
    }

    /* Анимация контента внутри сайдбара */
    .sidebar .brand__text,
    .sidebar .nav-item span:not(.icon-svg) {
        transition:
            opacity 0.2s ease,
            transform 0.2s ease,
            max-width 0.4s cubic-bezier(0.2, 0, 0, 1);

        opacity: 1;
        transform: translateX(0);
        white-space: nowrap; /* Чтобы текст не прыгал на новую строку */
        display: inline-block;
        max-width: 200px; /* Достаточно для текста */
        overflow: hidden;
    }

    .sidebar--collapsed {
        width: 80px !important;
    }

    /* Плавное скрытие текста при сворачивании */
    .sidebar--collapsed .brand__text,
    .sidebar--collapsed .nav-item span:not(.icon-svg) {
        opacity: 0;
        transform: translateX(-10px);
        pointer-events: none;
        max-width: 0;
        /* Ускоряем исчезновение, чтобы текст пропал до сужения панели */
        transition:
            opacity 0.15s ease,
            transform 0.15s ease,
            max-width 0.3s cubic-bezier(0.2, 0, 0, 1);
    }

    .sidebar--collapsed .sidebar__brand {
        flex-direction: column;
        gap: 12px;
        padding: 24px 0;
        align-items: center;
    }

    /* Важный момент: чтобы логотип не дергался при смене flex-direction */
    .sidebar .sidebar__brand {
        transition:
            gap 0.3s ease,
            padding 0.3s ease;
    }

    /* Расположение элементов меню */
    .sidebar .nav-item {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 12px 16px;
        transition:
            padding 0.3s ease,
            justify-content 0.3s ease;
    }

    .sidebar--collapsed .nav-item {
        justify-content: center;
        padding: 12px 0; /* Уменьшаем паддинги */
    }

    .sidebar--collapsed .nav-item .icon-svg {
        margin: 0; /* Убираем возможные отступы у иконки */
    }

    .sidebar--collapsed .sidebar__nav {
        padding: 0 12px;
    }

    .sidebar--collapsed .sidebar__collapse-btn {
        transform: rotate(180deg);
        margin-left: 0; /* Центрируем кнопку */
    }

    .sidebar__collapse-btn {
        transition:
            transform 0.4s cubic-bezier(0.2, 0, 0, 1),
            margin 0.3s ease;
    }

    /* Adjust main content when sidebar is collapsed */
    .workspace__content {
        transition:
            margin-left 0.4s cubic-bezier(0.2, 0, 0, 1),
            width 0.4s cubic-bezier(0.2, 0, 0, 1);
        will-change: margin-left, width;
    }

    .sidebar--collapsed + .workspace-mobile-header + .workspace__content,
    body:has(.sidebar--collapsed) .workspace__content {
        margin-left: 80px !important;
        width: calc(100% - 80px) !important;
    }
}

.sidebar__collapse-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--fg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 44px;
    height: 44px;
}

.sidebar__collapse-btn:hover {
    opacity: 1;
    background: var(--muted-2);
}

@media (max-width: 768px) {
    .sidebar__collapse-btn {
        display: none; /* Hide on mobile */
    }
}

#workspace-view > aside.sidebar--collapsed > nav > a.nav-item {
    gap: 0;
}

#workspace-view > aside > div > div {
    margin-right: 10px;
}

#workspace-view > aside.sidebar--collapsed > div > div {
    gap: 0;
    margin-bottom: 12px;
    margin-right: 0;
}

#workspace-view > aside.sidebar--collapsed > nav > a {
    width: 52px;
}

#workspace-content
    > div.dash-view
    > div
    > div.card.dash-card.profile-card.in
    > div.card__head {
    margin-bottom: 22px;
}

#workspace-content
    > div.dash-view
    > div
    > div.card.dash-card.profile-card.in
    > div.profile-summary {
    margin-bottom: 22px;
}

/* Sidebar Footer & Profile Section */
.sidebar__footer {
    margin-top: auto;
    padding: 32px 24px calc(33px + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-1);
    transition: all 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.sidebar__profile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    transition: all 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    position: relative;
    padding: 1px;
    flex-shrink: 0;
}

.avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 15px;
    background: var(--bg-1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.avatar-letter {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 600;
    color: var(--fg-strong);
}

.profile-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease,
        max-width 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.profile-name {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    color: var(--fg-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-uid {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--fg-muted);
    opacity: 0.7;
    white-space: nowrap;
}

.btn-notif {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--fg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* .btn-notif:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--fg-strong);
    border-color: var(--border-2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-notif:active {
    transform: translateY(0);
} */

.btn-notif .icon-svg {
    font-size: 22px;
}

/* Collapsed state adjustments for Footer */
.sidebar--collapsed .sidebar__footer {
    flex-direction: column-reverse;
    padding: 24px 0 calc(33px + env(safe-area-inset-bottom, 0px));
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.sidebar--collapsed .profile-meta {
    opacity: 0;
    max-width: 0;
    transform: translateX(-10px);
    pointer-events: none;
    margin: 0;
}

.sidebar--collapsed .sidebar__profile {
    gap: 0;
    justify-content: center;
}

.sidebar--collapsed .btn-notif {
    margin: 0 auto;
}

/* Team Analytics Empty State */
.team-analytics-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    min-height: 60vh;
    animation: fadeIn 0.8s ease forwards;
}

.empty-state-visual {
    position: relative;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-circle {
    width: 96px;
    height: 96px;
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    border-radius: 30px; /* Squircle style */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    position: relative;
    box-shadow: 0 15px 35px rgba(244, 63, 94, 0.3);
    transform: rotate(-5deg);
    transition: transform 0.3s ease;
}

.team-analytics-empty:hover .icon-circle {
    transform: rotate(0deg) scale(1.05);
}

.icon-circle .icon-svg {
    font-size: 48px;
    color: #fff;
}

.pulse-ring {
    position: absolute;
    width: 140px;
    height: 140px;
    border: 2px solid var(--accent-from);
    border-radius: 50%;
    opacity: 0;
    animation: teamPulse 2.5s infinite;
}

@keyframes teamPulse {
    0% {
        transform: scale(0.6);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.empty-title {
    font-family: var(--font-head);
    font-size: 28px;
    font-weight: 800;
    color: var(--fg-strong);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.empty-desc {
    font-size: 17px;
    color: var(--fg-muted);
    max-width: 480px;
    line-height: 1.6;
    margin-bottom: 32px;
}

.empty-actions {
    display: flex;
    gap: 16px;
}

@media (max-width: 768px) {
    .team-analytics-empty {
        padding: 40px 16px;
    }
    .empty-title {
        font-size: 22px;
    }
    .empty-desc {
        font-size: 15px;
    }
}
/* =========================================
   8. TEAMS NEW COMPONENTS (Admin State)
   ========================================= */

/* =========================================
   8. TEAMS NEW COMPONENTS (Admin State)
   ========================================= */

.team-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* Code Prefix "T" styling */
.code-cell--prefix {
    background-image: var(--accent-grad-vert);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #0b1220;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 25px;
    border-radius: 12px;
    user-select: none;
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.25);
    width: 42px;
    height: 48px;
}

/* Margin after applications */
.team-invite-card {
    margin-bottom: 16px;
}

.copy-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    color: var(--fg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.copy-btn:hover {
    background: var(--accent-grad);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.copy-btn:active {
    transform: translateY(0);
}

/* Admin Transfer Card (Dark per photo 3) */
.admin-transfer-card {
    background: rgba(244, 63, 94, 0.2);
    border: 1px solid var(--accent-from);
    padding: 24px;
    border-radius: 18px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.admin-transfer-card h3 {
    font-family: var(--font-head);
    letter-spacing: 0.02em;
}

.admin-transfer-card .btn--accent {
    width: 100%;
    margin-top: auto;
    padding: 14px;
    font-family: var(--font-head);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--accent-from);
}

/* Member List */
.team-members-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    padding: 4px; /* Space for hover glows */
    margin-left: -4px;
    margin-right: -4px;
}

#team-subview-container {
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}

.member-card {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 18px;
    gap: 16px;
    transition: all 0.3s ease;
    position: relative;
    user-select: none;
}

.member-card:hover {
    border-color: transparent;
    transform: translateX(4px);
    background: linear-gradient(
        90deg,
        rgba(244, 63, 94, 0.2) 0%,
        rgba(245, 158, 11, 0.2) 100%
    );
    z-index: 2;
}

.member-card:hover::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 18px;
    padding: 1px;
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Avatar with Instagram-style Ring */
.member-avatar-wrap {
    position: relative;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.member-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-muted);
    font-size: 20px;
    border: 2px solid transparent;
    position: relative;
    z-index: 2;
}

.member-info {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-weight: 600;
    color: var(--fg-strong);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-head);
    font-size: 17px;
}

.role-icon {
    font-size: 16px !important;
    color: #ffb800;
    filter: drop-shadow(0 0 4px rgba(255, 184, 0, 0.4));
}

.member-uid {
    font-size: 11px;
    color: var(--fg-muted);
    letter-spacing: 0.05em;
    font-family: monospace;
}

.member-actions {
    display: flex;
    gap: 12px;
}

.btn-icon-sm {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--fg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-icon-sm:hover {
    background: var(--muted-2);
    color: var(--fg-strong);
    border-color: var(--border-2);
    transform: scale(1.05);
}

.btn-icon-sm--danger:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-from);
    border-color: rgba(244, 63, 94, 0.4);
}

.add-member-btn {
    width: 100%;
    padding: 20px;
    border: 2px dashed var(--border);
    border-radius: 18px;
    background: transparent;
    color: var(--fg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 16px;
    font-family: var(--font-head);
    letter-spacing: 0.05em;
    position: relative;
}

.add-member-btn:hover {
    border-color: transparent;
    color: var(--fg-strong);
    background: linear-gradient(
        90deg,
        rgba(244, 63, 94, 0.2) 0%,
        rgba(245, 158, 11, 0.2) 100%
    );
}

.add-member-btn:hover::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 18px;
    padding: 1px;
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 0;
}

.team-separator {
    width: 100%;
    height: 1px;
    background: var(--border);
}

/* Team Footer */
.team-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 50px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.btn-leave {
    color: var(--accent-from);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 15px;
    opacity: 0.7;
}

.btn-leave:hover {
    opacity: 1;
    text-decoration: underline;
}

@media (max-width: 900px) {
    .team-info-grid {
        grid-template-columns: 1fr;
    }
}

.has-sub {
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.2);
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
}

/* Member Me highlight */
.member-me {
    background: var(--accent-grad-vert);
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    font-size: 13px;
    font-weight: 700;
}

/* Modal List Scrollbar */
.team-members-list::-webkit-scrollbar {
    width: 4px;
}
.team-members-list::-webkit-scrollbar-track {
    background: transparent;
}
.team-members-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* Confirm Modal specific */
#confirmModal .modal__panel {
    border: 1px solid var(--border);
    background: var(--bg-1) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

:root:not([data-theme="light"]) #confirmModal .modal__panel {
    background: #0d1425 !important;
    border-color: rgba(255, 255, 255, 0.1);
}

#confirmExtra {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

#confirmExtra:empty {
    display: none;
}

/* Danger modal style (isDanger = true) */
.modal--danger .modal__panel {
    border-color: var(--accent-from) !important;
    background: var(--bg-1) !important;
    box-shadow: 0 20px 50px rgba(244, 63, 94, 0.15);
}

:root:not([data-theme="light"]) .modal--danger .modal__panel {
    background: #0f101a !important;
}

.modal--danger .modal__title {
    color: var(--accent-from) !important;
}

.modal--danger #confirmIcon {
    color: var(--accent-from);
    font-size: 24px;
    font-variation-settings: "FILL" 1;
}

.modal--danger #confirmBtn {
    background-image: linear-gradient(135deg, #f43f5e, #e11d48) !important;
    color: #fff !important;
    font-weight: 800;
}

/* Report Reasons Buttons */
.reason-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.reason-btn {
    padding: 14px 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    color: var(--fg-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    border-style: dashed;
}

:root[data-theme="light"] .reason-btn {
    background: rgba(0, 0, 0, 0.02);
}

.reason-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--fg-strong);
    border-color: var(--border-2);
    transform: translateY(-1px);
}

:root[data-theme="light"] .reason-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.reason-btn.active {
    background: rgba(244, 63, 94, 0.1);
    border-color: var(--accent-from);
    color: var(--accent-from);
    border-style: solid;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.1);
}

/* Leave Team Link */
.leave-link {
    color: #f43f5e;
    font-size: 14px;
    text-decoration: none;
    font-family: var(--font-head);
    letter-spacing: 0.02em;
    opacity: 0.7;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-block;
}

.leave-link:hover {
    opacity: 1;
    text-shadow: 0 0 8px rgba(244, 63, 94, 0.3);
}

.team-leave-wrap {
    text-align: left;
    padding-top: 12px;
}

.member-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 16px;
    opacity: 0.5;
}

/* ==========================================================================
   TEAM ANALYTICS STYLES
   ========================================================================== */

.analytics-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 40px;
}

/* Base Analytics Card (Solid, not glass) */
.analytics-card {
    background: var(--bg-dark); /* Solid dark background from design */
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

/* Grids */
.analytics-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.analytics-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.analytics-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.stat-card.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 250px; /* Increased to accommodate content and keep lines aligned */
    padding: 24px 20px;
}

/* Container for top content to align the divider */
.stat-card.centered .stat-top-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}

.stat-card.centered.no-hover {
    cursor: default;
}

.stat-card.centered .stat-icon-box {
    margin-bottom: 20px;
    transform: scale(1.1);
}

.stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--fg-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-family: var(--font-head);
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 24px;
}

.stat-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.stat-icon-box::after {
    content: "";
    position: absolute;
    inset: 0;
    background: inherit;
    filter: blur(12px);
    opacity: 0.4;
    z-index: -1;
    border-radius: inherit;
}

/* Semi-transparent icon backgrounds */
.bg-orange-soft {
    background: rgba(245, 158, 11, 0.1);
}
.bg-pink-soft {
    background: rgba(244, 63, 94, 0.1);
}
.bg-green-soft {
    background: rgba(16, 185, 129, 0.1);
}
.bg-blue-soft {
    background: rgba(59, 130, 246, 0.1);
}

.text-orange-icon {
    color: #f59e0b;
}
.text-pink-icon {
    color: #f43f5e;
}
.text-green-icon {
    color: #10b981;
}
.text-blue-icon {
    color: #3b82f6;
}

.stat-footer {
    border-top: 1px solid var(--border-glass);
    padding-top: 16px;
}

/* Progress bar in stat card */
.stat-footer-alt {
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* 1. Glow Progress (Card 1) */
.glow-progress {
    width: 85%;
    height: 6px;
    background: var(--muted);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    margin-bottom: 4px;
}

.glow-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    border-radius: inherit;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.stat-hint {
    font-size: 11px;
    color: var(--fg-muted);
}

/* 2. Simple Trend - Now as a Pill Badge (Card 2) */
.trend-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    padding: 6px 14px;
    border-radius: 30px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.15);
    color: var(--green);
    margin-top: 5px;
}

.trend-pill.trend-down {
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.15);
    color: var(--accent-from);
}

.trend-pill .icon-svg {
    font-size: 14px;
}

/* 3. Bar Rows (Card 3) */
.bar-rows {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0 20px;
}

.bar-row .r {
    font-size: 11px;
    font-weight: 800;
    color: var(--fg-muted);
    min-width: 24px;
}

.bar-row .b {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.bar-row .f {
    height: 100%;
    border-radius: inherit;
}

.bar-row .f.gold {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
}
.bar-row .f.silver {
    background: linear-gradient(90deg, #e2e8f0, #94a3b8);
}
.bar-row .f.bronze {
    background: linear-gradient(90deg, #d97706, #92400e);
}

/* 4. Split Stats (Card 4) */
.split-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
}

.s-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.s-divider {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
}

.s-item .v {
    font-size: 20px;
    font-weight: 800;
    font-family: var(--font-head);
}

.s-item .l {
    font-size: 10px;
    color: var(--fg-muted);
    font-weight: 700;
    margin-top: 4px;
}

/* Compact Badge Trends (only for 3-grid detail cards) */
.analytics-grid-3 .trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 30px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.analytics-grid-3 .trend-up {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.15);
    color: var(--green);
}

.analytics-grid-3 .trend-down {
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.15);
    color: var(--accent-from);
}

.trend .icon-svg {
    font-size: 14px;
}

/* Top 3 Progress bar list */
.top3-progress-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top3-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top3-item .rank {
    font-size: 12px;
    font-weight: 700;
    width: 20px;
}

.top3-item .bar-wrap {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.top3-item .bar-fill {
    height: 100%;
    border-radius: 10px;
}

.bg-orange {
    background: #f59e0b;
}
.bg-gray {
    background: #94a3b8;
}
.bg-bronze {
    background: #d97706;
}

.small-stats-row {
    display: flex;
    gap: 16px;
}

.small-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    padding-right: 12px;
}

.small-stat-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.small-stats-row::-webkit-scrollbar {
    display: none;
}

.small-stat-item {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: max-content;
}

.small-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.small-stat-content .label {
    font-size: 12px;
    color: var(--fg-muted);
}

.small-stat-content .value {
    font-size: 18px;
    font-weight: 800;
    font-family: var(--font-head);
}

.small-stat-item .trend {
    margin-left: 8px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.chart-title {
    margin: 0;
    font-size: 18px;
    font-family: var(--font-head);
}

.chart-periods {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.period-btn {
    background: transparent;
    border: none;
    color: var(--fg-muted);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 11px;
    font-family: var(--font-head);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.period-btn:hover {
    color: var(--fg);
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.period-btn.active {
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.chart-container {
    min-height: 400px;
}

.performance-chart-svg {
    width: 100%;
    height: auto;
}

.axis-labels text {
    fill: var(--fg-muted);
    font-size: 12px;
}

/* Best Tour Card (Right side) */
.best-tour-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: linear-gradient(
        135deg,
        rgba(244, 63, 94, 0.15) 0%,
        rgba(245, 158, 11, 0.15) 100%
    );
    border: 1px solid rgba(244, 63, 94, 0.4);
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] .best-tour-card {
    background: linear-gradient(
        135deg,
        rgba(244, 63, 94, 0.14) 0%,
        rgba(245, 158, 11, 0.14) 100%
    );
    border-color: rgba(244, 63, 94, 0.25);
}

.card-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, var(--accent-from) 0%, transparent 70%);
    opacity: 0.15;
    filter: blur(30px);
    pointer-events: none;
}

.tour-visual {
    margin: 32px 0;
}

.tour-medal {
    width: 100px;
    height: 100px;
    background: linear-gradient(
        135deg,
        rgba(245, 158, 11, 0.15),
        rgba(245, 158, 11, 0.05)
    );
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(245, 158, 11, 0.1);
}

.tour-medal::after {
    content: "";
    position: absolute;
    inset: -15px;
    background: radial-gradient(
        circle,
        rgba(245, 158, 11, 0.15) 0%,
        transparent 70%
    );
    z-index: -1;
}

.tour-medal .icon-svg {
    font-size: 48px;
    color: var(--accent-to);
    filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.5));
}

.best-tour-card .tour-name {
    font-family: var(--font-head);
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 4px;
}

.best-tour-card .tour-date {
    font-size: 13px;
    color: var(--fg-muted);
}

.tour-stats-list {
    width: 100%;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.01);
    padding: 15px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.t-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 4px 0;
}

.t-stat:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 8px;
}

.t-stat span:first-child {
    color: var(--fg-muted);
    font-weight: 600;
}

.t-stat .val {
    font-weight: 800;
    font-size: 15px;
    font-family: var(--font-head);
    color: var(--fg);
}

.t-stat .val.text-green {
    color: var(--green);
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

/* Results Table */
.results-table-wrap {
    width: 100%;
    overflow-x: auto;
}

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

.results-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--fg-muted);
    border-bottom: 1px solid var(--border-glass);
}

.results-table td {
    padding: 20px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.results-table tr:last-child td {
    border-bottom: none;
}

.results-table .tour-name-cell {
    font-weight: 600;
    color: var(--fg);
}

.results-table .date-cell,
.results-table .rank-cell {
    color: var(--fg-muted);
}

.results-table .points-cell {
    font-weight: 700;
    text-align: right;
}

/* Text colors helper */
.text-green {
    color: var(--green);
}
.text-danger {
    color: var(--accent-from);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .analytics-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .analytics-grid-4 {
        grid-template-columns: 1fr;
    }
    .analytics-main-grid {
        grid-template-columns: 1fr;
    }
    .analytics-grid-3 {
        grid-template-columns: 1fr;
    }

    .stat-card.centered .stat-value {
        font-size: 32px;
    }
}

@media (max-width: 380px) {
    .analytics-layout {
        gap: 16px;
    }
    .analytics-card {
        padding: 20px 16px;
    }
    .stat-card.centered .stat-value {
        font-size: 28px;
    }
}

/* ==========================================================================
   TEAM SECTION — RESPONSIVE ADAPTATION (down to 320px)
   ========================================================================== */

/* ——— 900px: medium tablets ——— */
@media (max-width: 900px) {
    /* Owner description + admin-transfer grid (inline style override) */
    #team-subview-container > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* ——— 768px: tablets / mobile sidebar ——— */
@media (max-width: 768px) {
    .team-view {
        padding-left: 16px;
        padding-right: 16px;
    }

    .tabs-nav {
        gap: 0;
    }

    .tab-item {
        flex: 1;
        justify-content: center;
        padding: 10px 8px;
    }

    .tab-text {
        font-size: 13px;
    }

    /* Team action cards (create / join) */
    .team-actions-grid {
        grid-template-columns: 1fr;
    }

    .team-action-card {
        padding: 24px;
    }

    /* Team section head */
    .team-section-title {
        font-size: 20px;
    }

    .team-section-desc {
        font-size: 14px;
    }

    /* Member card */
    .member-card {
        padding: 12px 16px;
        gap: 12px;
    }

    .member-name {
        font-size: 15px;
        flex-wrap: wrap;
    }

    /* Team footer (owner) — inline style override */
    .team-footer {
        flex-direction: column !important;
        gap: 16px !important;
        align-items: stretch !important;
    }

    .team-footer .btn--accent {
        min-width: unset !important;
        width: 100%;
    }

    .team-footer .leave-link {
        text-align: center;
        order: 2;
    }

    .team-footer .btn--accent {
        order: 1;
    }

    /* Admin transfer card */
    .admin-transfer-card {
        padding: 20px;
    }

    /* Chart periods (analytics) */
    .chart-periods {
        flex-wrap: wrap;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Best tour card */
    .tour-medal {
        width: 80px;
        height: 80px;
    }

    .tour-medal .icon-svg {
        font-size: 40px;
    }

    .best-tour-card .tour-name {
        font-size: 18px;
    }
}

/* ——— 600px: large phones ——— */
@media (max-width: 600px) {
    .team-view {
        padding-left: 12px;
        padding-right: 12px;
    }

    .dash-header {
        font-size: 24px;
    }

    .team-action-card {
        padding: 20px;
        gap: 16px;
        border-radius: 20px;
    }

    .action-title {
        font-size: 16px;
    }

    .action-desc {
        font-size: 13px;
        margin-bottom: 20px;
    }

    .btn--wide {
        max-width: 100%;
    }

    /* Member card responsive */
    .member-card {
        padding: 12px;
        border-radius: 14px;
        gap: 10px;
    }

    .member-name {
        font-size: 14px;
        gap: 4px;
    }

    .member-uid {
        font-size: 10px;
    }

    .member-actions {
        gap: 8px;
    }

    .btn-icon-sm {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .btn-icon-sm .icon-svg {
        font-size: 18px;
    }

    /* Add member button */
    .add-member-btn {
        padding: 16px;
        font-size: 14px;
        border-radius: 14px;
    }

    /* Compose (owner in-team) roster heading */
    .team-section-head[data-view-anim] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }

    /* Team info inputs */
    .team-info-grid .field label {
        font-size: 13px;
    }

    .team-info-grid .input {
        font-size: 14px;
    }

    /* Results table */
    .results-table th,
    .results-table td {
        padding: 12px 10px;
        font-size: 12px;
    }

    .results-table .tour-name-cell {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Stat card adjustments */
    .stat-card.centered {
        min-height: 220px;
        padding: 20px 16px;
    }

    .stat-icon-box {
        width: 42px;
        height: 42px;
    }

    .stat-label {
        font-size: 11px;
    }

    /* Small stat cards */
    .small-stat {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding-right: 0;
    }

    .small-stat .trend {
        align-self: flex-end;
    }

    /* Chart container height */
    .chart-container {
        min-height: 300px;
    }

    .chart-box {
        height: 220px !important;
    }
}

/* ——— 480px: small phones ——— */
@media (max-width: 480px) {
    .team-view {
        padding-left: 8px;
        padding-right: 8px;
    }

    .team-invite-card {
        padding: 16px;
        border-radius: 18px;
        margin: 20px 0 10px 0;
    }

    .invite-icon-box {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .invite-icon-box .icon-svg {
        font-size: 22px;
    }

    .invite-title {
        font-size: 14px;
        line-height: 20px;
    }

    .invite-desc {
        font-size: 12px;
    }

    /* Owner description + admin-transfer */
    .admin-transfer-card {
        padding: 16px;
        border-radius: 14px;
        gap: 12px;
    }

    .admin-transfer-card h3 {
        font-size: 14px !important;
    }

    .admin-transfer-card p {
        font-size: 12px !important;
    }

    /* Team footer */
    .team-footer .btn--accent {
        padding: 12px !important;
        font-size: 14px;
    }

    /* Member avatar  */
    .profile-avatar {
        width: 36px;
        height: 36px;
    }

    .avatar-letter {
        font-size: 15px;
    }

    /* Tab text */
    .tab-item .icon {
        font-size: 18px;
    }

    .tab-text {
        font-size: 12px;
    }

    /* Analytics */
    .stat-card.centered {
        min-height: 200px;
    }

    .stat-value {
        font-size: 30px;
        margin-bottom: 16px;
    }

    .stat-card.centered .stat-icon-box {
        transform: scale(1);
        margin-bottom: 14px;
    }

    .glow-progress {
        width: 100%;
    }

    /* Bar rows */
    .bar-row {
        padding: 0 8px;
    }

    /* Best tour card */
    .best-tour-card {
        padding: 20px 16px;
    }

    .tour-visual {
        margin: 20px 0;
    }

    .tour-medal {
        width: 72px;
        height: 72px;
        border-radius: 20px;
    }

    .tour-medal .icon-svg {
        font-size: 36px;
    }

    .best-tour-card .tour-name {
        font-size: 16px;
    }

    /* Period buttons */
    .period-btn {
        padding: 5px 10px;
        font-size: 10px;
    }

    /* Split stats (card 4) */
    .s-item .v {
        font-size: 16px;
    }

    .s-item .l {
        font-size: 9px;
    }

    /* Table adjustments */
    .results-table .date-cell {
        display: none;
    }
}

/* ——— 380px: very narrow screens ——— */
@media (max-width: 380px) {
    .team-action-card {
        padding: 16px;
        gap: 12px;
        border-radius: 16px;
    }

    .action-icon-box {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .action-icon-box span,
    .action-icon-box .icon-svg {
        font-size: 20px;
    }

    .action-title {
        font-size: 15px;
    }

    .action-desc {
        font-size: 12px;
        margin-bottom: 16px;
    }

    .team-section-title {
        font-size: 18px;
    }

    .team-section-desc {
        font-size: 13px;
    }

    .member-card {
        padding: 10px;
        border-radius: 12px;
        gap: 8px;
    }

    .member-name {
        font-size: 13px;
    }

    .member-me {
        font-size: 11px;
    }

    .member-uid {
        font-size: 9px;
    }

    .member-actions {
        gap: 6px;
    }

    .btn-icon-sm {
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }

    .btn-icon-sm .icon-svg {
        font-size: 16px;
    }

    .add-member-btn {
        padding: 14px;
        gap: 8px;
        font-size: 13px;
    }

    /* Team info grid fields */
    .team-info-grid {
        gap: 14px;
        margin-bottom: 18px;
    }

    .copy-btn {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .copy-btn .icon-svg {
        font-size: 18px;
    }

    /* Tabs */
    .tabs-nav {
        margin-bottom: 8px;
    }

    /* Empty state */
    .empty-title {
        font-size: 20px;
    }

    .empty-desc {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .icon-circle {
        width: 80px;
        height: 80px;
        border-radius: 24px;
    }

    .icon-circle .icon-svg {
        font-size: 40px;
    }

    .pulse-ring {
        width: 120px;
        height: 120px;
    }

    /* Analytics cards */
    .stat-card.centered .stat-value {
        font-size: 26px;
    }

    .trend-pill {
        padding: 4px 10px;
        font-size: 10px;
    }

    .stat-hint {
        font-size: 10px;
    }

    /* Small stats */
    .small-stat-content .label {
        font-size: 11px;
    }

    .small-stat-content .value {
        font-size: 16px;
    }

    .small-stat-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .small-stat-icon .icon-svg {
        font-size: 18px;
    }

    /* Tour stats list */
    .tour-stats-list {
        padding: 10px;
    }

    .t-stat {
        font-size: 12px;
    }

    .t-stat .val {
        font-size: 13px;
    }
}

/* ——— 320px: minimum supported width ——— */
@media (max-width: 320px) {
    .team-view {
        padding-left: 4px;
        padding-right: 4px;
        padding-bottom: 24px;
    }

    .team-invite-card {
        padding: 12px;
        border-radius: 14px;
        gap: 12px;
        margin: 16px 0 8px 0;
    }

    .invite-icon-box {
        width: 32px;
        height: 32px;
        border-radius: 10px;
    }

    .invite-icon-box .icon-svg {
        font-size: 18px;
    }

    .invite-title {
        font-size: 13px;
        line-height: 18px;
    }

    .invite-desc {
        font-size: 11px;
        line-height: 16px;
    }

    .invite-actions .btn {
        padding: 8px 12px !important;
        font-size: 12px;
    }

    .team-action-card {
        padding: 14px;
        gap: 10px;
        border-radius: 14px;
    }

    .action-icon-box {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .action-icon-box span,
    .action-icon-box .icon-svg {
        font-size: 18px;
    }

    .action-title {
        font-size: 14px;
    }

    .action-desc {
        font-size: 11px;
        margin-bottom: 12px;
        line-height: 1.5;
    }

    .btn--wide {
        height: 40px;
        font-size: 13px;
    }

    .team-section-title {
        font-size: 16px;
    }

    .team-section-desc {
        font-size: 12px;
    }

    .team-section-head {
        margin-bottom: 16px;
    }

    .member-card {
        padding: 8px;
        border-radius: 10px;
        gap: 6px;
    }

    .member-name {
        font-size: 12px;
        flex-wrap: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
    }

    .member-me {
        font-size: 10px;
    }

    .member-uid {
        font-size: 8px;
    }

    .member-info {
        overflow: hidden;
    }

    .profile-avatar {
        width: 32px;
        height: 32px;
        border-radius: 12px;
    }

    .avatar-inner {
        border-radius: 11px;
    }

    .avatar-letter {
        font-size: 13px;
    }

    /* Team code grid in modal */
    .team-code-grid {
        grid-template-columns: repeat(10, 28px);
        gap: 3px;
    }

    .team-code-grid .code-cell {
        width: 28px;
        height: 36px;
        font-size: 18px;
        border-radius: 8px;
    }

    .team-code-grid .code-cell--prefix {
        border-radius: 8px;
    }

    .add-member-btn {
        padding: 12px;
        font-size: 12px;
        gap: 6px;
        border-radius: 10px;
    }

    .team-info-grid {
        gap: 10px;
        margin-bottom: 14px;
    }

    .copy-btn {
        width: 32px;
        height: 32px;
    }

    .admin-transfer-card {
        padding: 12px;
        border-radius: 12px;
    }

    .tab-item {
        padding: 8px 4px;
    }

    .tab-text {
        font-size: 11px;
    }

    .tab-item .icon {
        font-size: 16px;
    }

    /* Analytics at 320px */
    .analytics-layout {
        gap: 12px;
    }

    .analytics-card {
        padding: 16px 12px;
        border-radius: 18px;
    }

    .stat-card.centered {
        min-height: 180px;
        padding: 16px 12px;
    }

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

    .stat-label {
        font-size: 10px;
    }

    .stat-icon-box {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .stat-icon-box .icon-svg {
        font-size: 20px;
    }

    .stat-footer-alt {
        padding-top: 14px;
        gap: 8px;
    }

    .chart-container {
        min-height: 260px;
    }

    .chart-box {
        height: 180px !important;
    }

    .chart-title {
        font-size: 15px;
    }

    .period-btn {
        padding: 4px 8px;
        font-size: 9px;
    }

    .chart-periods {
        padding: 2px;
        gap: 2px;
    }

    .best-tour-card {
        padding: 16px 12px;
    }

    .tour-visual {
        margin: 16px 0;
    }

    .tour-medal {
        width: 64px;
        height: 64px;
        border-radius: 16px;
        margin-bottom: 16px;
    }

    .tour-medal .icon-svg {
        font-size: 32px;
    }

    .best-tour-card .tour-name {
        font-size: 15px;
    }

    .best-tour-card .tour-date {
        font-size: 12px;
    }

    .results-table th {
        font-size: 9px;
        padding: 8px 6px;
    }

    .results-table td {
        font-size: 11px;
        padding: 10px 6px;
    }

    .results-table .tour-name-cell {
        max-width: 90px;
    }

    /* Empty state */
    .team-analytics-empty {
        padding: 30px 8px;
        min-height: 40vh;
    }

    .empty-state-visual {
        margin-bottom: 24px;
    }

    .empty-title {
        font-size: 18px;
    }

    .empty-desc {
        font-size: 13px;
        margin-bottom: 20px;
    }

    .empty-actions .btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* PROFILE SECTION - NEW DESIGN */
.profile-view {
    padding-bottom: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.profile-head-header {
    font-size: 32px;
    font-weight: 300;
    margin-bottom: 32px;
    margin-top: 0;
    color: var(--fg-strong);
    font-family: var(--font-head);
}

.profile-nav-tabs {
    display: flex;
    gap: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 48px;
    padding-bottom: 2px;
}

.profile-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    color: var(--fg-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.profile-nav-item .icon-svg {
    font-size: 20px;
}

.profile-nav-item:hover {
    color: var(--fg);
}

.profile-nav-item.active {
    background: linear-gradient(90deg, #f43f5e, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom-color: var(--accent-from);
}

.profile-nav-item.active .icon-svg {
    fill: url(#navGradient) !important;
    color: transparent;
}

/* User Info Bar */
.profile-user-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 48px;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        rgba(244, 63, 94, 0.3),
        rgba(245, 158, 11, 0.3)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.profile-avatar-large .avatar-visual {
    width: 70px;
    height: 70px;
    background: #e2e2e2;
    clip-path: circle(50% at 50% 50%); /* Simplified avatar shape from SVG */
    mask: url("data:image/svg+xml,%3Csvg width='70' height='70' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M50 0C22.4 0 0 22.4 0 50s22.4 50 50 50 50-22.4 50-50S77.6 0 50 0zm0 15c8.3 0 15 6.7 15 15s-6.7 15-15 15-15-6.7-15-15 6.7-15 15-15zm0 75c-11.8 0-22.5-4.8-30.2-12.6 2.3-10.4 11.6-18.4 22.7-18.4h14.9c11.1 0 20.4 8 22.7 18.4-7.7 7.8-18.4 12.6-30.1 12.6z'/%3E%3C/svg%3E")
        no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg width='70' height='70' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M50 0C22.4 0 0 22.4 0 50s22.4 50 50 50 50-22.4 50-50S77.6 0 50 0zm0 15c8.3 0 15 6.7 15 15s-6.7 15-15 15-15-6.7-15-15 6.7-15 15-15zm0 75c-11.8 0-22.5-4.8-30.2-12.6 2.3-10.4 11.6-18.4 22.7-18.4h14.9c11.1 0 20.4 8 22.7 18.4-7.7 7.8-18.4 12.6-30.1 12.6z'/%3E%3C/svg%3E")
        no-repeat center;
}

/* Fallback letter if no image */
.profile-avatar-large .avatar-placeholder {
    width: 60px;
    height: 60px;
    background: #d1d5db;
    border-radius: 18px 18px 4px 4px;
    position: relative;
}

.profile-user-meta {
    flex: 1;
}

.profile-fullname {
    font-size: 28px;
    font-weight: 500;
    margin: 0;
    color: var(--fg-strong);
}

.profile-uid-label {
    color: var(--fg-muted);
    font-size: 16px;
    margin-top: 4px;
}

.btn-upload-photo {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--fg-muted);
    padding: 12px 24px;
    /* border-radius: 99px; */
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-upload-photo:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--fg);
}

/* Form Container */
.profile-form-container {
    background: #11141d;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 48px;
}

.profile-new-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px 24px;
}

.profile-new-grid .field {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-new-grid label {
    font-size: 14px;
    color: var(--fg-muted);
    font-weight: 500;
}

.profile-new-grid .input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 18px;
    color: var(--fg);
    font-size: 15px;
    transition: all 0.2s ease;
}

.profile-new-grid .input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-from);
    outline: none;
}

/* Footer Actions */
.profile-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 48px;
}

.btn-logout-link {
    color: #f43f5e;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: opacity 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.btn-logout-link:hover {
    opacity: 0.8;
}

.btn-save-large {
    background: linear-gradient(90deg, #f43f5e 0%, #f59e0b 100%);
    color: #000;
    border: none;
    padding: 16px 40px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition:
        transform 0.2s,
        box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.3);
}

.btn-save-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(244, 63, 94, 0.4);
}

.btn-save-large:active {
    transform: translateY(0);
}

@media (max-width: 900px) {
    .profile-new-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .profile-new-grid {
        grid-template-columns: 1fr;
    }
    .profile-user-bar {
        flex-direction: column;
        text-align: center;
    }
    .profile-footer-row {
        flex-direction: column;
        gap: 24px;
    }
    .btn-save-large {
        width: 100%;
    }
}

.profile-avatar.large {
    width: 100px;
    height: 100px;
}

.profile-avatar.large .avatar-inner {
    width: 98px;
    height: 98px;
}

.profile-avatar.large .avatar-letter {
    font-size: 48px;
}
/* Input Changed State (Gradient Border) */
.input.is-changed {
    border-color: transparent;
    background-image:
        linear-gradient(var(--bg-dark), var(--bg-dark)),
        linear-gradient(90deg, var(--accent-from), var(--accent-to));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.15);
}

/* Autocomplete Dropdown */
.autocomplete-wrap {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: none;
}

.autocomplete-dropdown.visible {
    display: block;
}

.autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--fg);
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: var(--muted);
}

.autocomplete-item strong {
    color: var(--accent-from);
}

/* Button Disabled State (Explicit) */
.btn.is-disabled {
    background: var(--muted);
    color: var(--fg-muted);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
    pointer-events: none;
}

/* =========================================
   VALIDATION & AUTOCOMPLETE UI
   ========================================= */

#profile-detailed-form .field {
    position: relative;
    margin-bottom: 28px;
}

#profile-detailed-form .field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--fg-muted);
    margin-bottom: 8px;
    transition: color 0.2s ease;
}

.input {
    width: 100%;
    font-family: var(--font-body);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Стилизация инпутов только в профиле */
#profile-detailed-form .input {
    padding: 12px 16px;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    color: var(--fg);
    font-size: 16px;
    font-family: var(--font-body);
}

.input:focus {
    outline: none;
    border-color: var(--accent-from);
    background: var(--muted-2);
}

/* Красивый фокус только в профиле */
#profile-detailed-form .input:focus {
    box-shadow: 0 0 0 4px
        color-mix(in oklab, var(--accent-from) 15%, transparent);
}

#profile-detailed-form .input.is-changed {
    border-color: transparent !important;
    background-origin: border-box;
    background-clip: padding-box, border-box !important;
    background-image:
        linear-gradient(var(--bg-1), var(--bg-1)), var(--accent-grad);
    border: 1px solid transparent;
}

#profile-detailed-form .input.is-invalid {
    border-color: #ff4757 !important;
    background: color-mix(in oklab, #ff4757 5%, transparent);
}

#profile-detailed-form .field-error {
    position: absolute;
    bottom: -18px;
    left: 4px;
    font-size: 11px;
    color: #ff4757;
    font-weight: 600;
    opacity: 0;
    transition: all 0.2s ease;
    pointer-events: none;
}

#profile-detailed-form .field:has(.is-invalid) .field-error {
    opacity: 1;
    transform: translateY(0);
}

/* Autocomplete Premium Look */
.autocomplete-wrap {
    position: relative;
    width: 100%;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: color-mix(in oklab, var(--bg-1) 95%, #fff);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(12px);
}

.autocomplete-dropdown.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--fg);
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.focused {
    background: var(--accent-grad) !important;
    color: #fff !important;
    font-weight: 800;
    padding-left: 20px;
}

.autocomplete-item strong {
    color: var(--accent-from);
    font-weight: 700;
}

/* Phone Mask Hint */
.input-hints {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.hint-tag {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--muted);
    border-radius: 4px;
    color: var(--fg-muted);
}

.autocomplete-item.focused {
    background: var(--accent-grad) !important;
    color: #0b1220 !important;
    font-weight: 800;
    padding-left: 20px;
}

.autocomplete-item.focused strong,
.autocomplete-item:hover strong {
    color: #fff !important;
}

/* --- SVG Icons --- */
.icon-svg {
    font-size: 24px;
    line-height: 1;
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em; /* Compensate for descender just like text */
    fill: currentColor;
    flex-shrink: 0;
    transition:
        color 0.2s ease,
        fill 0.2s ease;
}

/* SVG Fill Toggles (Replacing Font FILL property) */
.nav-item:hover:not(.active) .icon-svg .svg-outline,
.card-icon .svg-outline,
.icon-svg.fill-active .svg-outline,
.nav-item.active .icon-svg .svg-outline {
    display: none !important;
}

.nav-item:hover:not(.active) .icon-svg .svg-filled,
.card-icon .svg-filled,
.icon-svg.fill-active .svg-filled,
.nav-item.active .icon-svg .svg-filled {
    display: unset !important;
}

.text-black {
    color: #000 !important;
    fill: #000 !important;
    -webkit-text-fill-color: initial !important;
    background-clip: border-box !important;
}

.tab-item.active .icon-svg {
    fill: url(#navGradient) !important;
    background: none !important;
    color: transparent !important;
    -webkit-text-fill-color: initial !important;
    background-clip: border-box !important;
}

.tab-item .icon-svg {
    color: inherit;
    transition: inherit;
    fill: currentColor;
}

.action-icon-box svg {
    color: #000 !important;
    fill: #000 !important;
    stroke: #000 !important;
}

/* --- Toggle Switch --- */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.05);
    transition: 0.3s;
    border-radius: 24px;
    border: 1px solid var(--border);
}
.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 1px;
    background-color: var(--fg-muted);
    transition: 0.3s;
    border-radius: 50%;
}
.switch input:checked + .switch-slider {
    background: var(--accent-grad);
    border-color: transparent;
}
.switch input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: #fff;
}

/* --- Profile Security & Analytics --- */
.profile-section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--fg);
}
.security-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}
@media (max-width: 900px) {
    .security-grid {
        grid-template-columns: 1fr;
    }
}
.security-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}
.security-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.security-setting-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.security-setting-info .title {
    font-weight: 500;
    margin-bottom: 4px;
}
.security-setting-info .desc {
    font-size: 13px;
    color: var(--fg-muted);
}
.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.session-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.session-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    flex-shrink: 0;
}
.session-info-main {
    display: flex;
    align-items: center;
}
.session-details .device {
    font-weight: 500;
    margin-bottom: 4px;
}
.session-details .meta {
    font-size: 13px;
    color: var(--fg-muted);
}
.session-actions .btn {
    padding: 6px 16px;
    font-size: 13px;
}
.btn-logout-all {
    margin-top: 16px;
    width: 100%;
}

/* --- True Profile Security Layout --- */
.security-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 32px;
}
.security-card-full {
    background: #111115;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 24px;
    min-width: 300px;
    flex: 1 1 500px;
}
.security-grid-bot {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    width: 100%;
}
.security-grid-bot > * {
    flex: 1 1 300px;
}
.sec-header {
    margin-bottom: 32px;
}
.sec-header-border {
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 24px;
}
.sec-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--fg);
    margin: 0 0 8px 0;
}
.sec-desc {
    font-size: 14px;
    color: var(--fg-muted);
    margin: 0;
}
.sec-pass-row {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 24px;
}
.sec-pass-row-new {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 24px;
}
.pass-group-col {
    flex: 1 1 calc(33.333% - 24px);
    min-width: 200px;
}
.input-sec {
    background: #16161b;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 12px !important;
    padding-right: 48px !important; /* Make room for icon */
}
.input-group-sec .input-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #1c1c22;
    border-radius: 8px;
    width: 32px;
    height: 32px;
}
.sec-pass-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}
.sec-pass-footer-new {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.sec-pass-footer .btn {
    width: 100%;
}
.sec-link {
    color: var(--fg-muted);
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s;
}
.sec-link:hover {
    color: var(--fg);
}
.sec-list {
    display: flex;
    flex-direction: column;
}
.sec-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.sec-list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.sec-list-item:first-child {
    padding-top: 0;
}
.session-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.session-icon {
    width: 40px;
    height: 40px;
    color: var(--fg-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 8px;
}
.sec-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.s-title {
    font-size: 15px;
    color: var(--fg);
    font-weight: 500;
}
.s-sub {
    font-size: 13px;
    color: var(--fg-muted);
}
.text-warning {
    color: #10b981; /* Green */
}
.btn-text {
    background: #1c1c22;
    padding: 6px 16px;
    border-radius: 8px;
    border: none;
    color: var(--fg-muted);
    font-size: 13px;
    cursor: pointer;
}
.btn-text:hover {
    color: var(--fg);
    background: #25252a;
}
.text-danger {
    color: var(--danger, #ef4444);
}
.sec-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 24px;
}
.sec-footer-text {
    font-size: 14px;
    color: var(--fg-muted);
}
.flex {
    display: flex;
}
.flex-col {
    flex-direction: column;
}
.gap-24 {
    gap: 24px;
}
