/* Личный кабинет и кнопка аккаунта — визуальный язык Prokatavto360 */

:root {
    --cab-bg: #f5f4f2;
    --cab-white: #ffffff;
    --cab-text: #272824;
    --cab-muted: rgba(39, 40, 36, 0.64);
    --cab-border: rgba(210, 208, 204, 0.55);
    --cab-lime: #10b981;
    --cab-lime-hover: #059669;
    --cab-sidebar: #141412;
    --cab-sidebar-w: 260px;
    --cab-radius: 20px;
    --cab-shadow: 0 2px 16px rgba(39, 40, 36, 0.06);
    --cab-sticky-top: 72px;
}

/* ——— Шапка: чип аккаунта ——— */
.desktop-only-header .header-main {
    position: relative;
    z-index: 4;
}
.desktop-only-header .ks-auth-wrap {
    position: relative;
    z-index: 5;
    overflow: visible;
}
.u360-profile-drop {
    position: relative;
    z-index: 40;
}
.u360-profile-drop::after {
    content: '';
    position: absolute;
    top: 100%;
    left: -8px;
    right: -8px;
    height: 14px;
    z-index: 41;
    pointer-events: none;
}
.u360-profile-drop:hover::after,
.u360-profile-drop.is-open::after,
.u360-profile-drop:focus-within::after {
    pointer-events: auto;
}

.u360-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 220px;
    padding: 5px 12px 5px 5px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.28);
    color: #141412;
    box-shadow: inset 0 0 0 1px rgba(180, 210, 20, 0.55);
    font-weight: 800;
    font-size: 14px;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}
.u360-profile-link:hover {
    background: rgba(16, 185, 129, 0.42);
    color: #141412;
}
.u360-profile-link::after {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.25);
    flex-shrink: 0;
}
.u360-profile-link .label {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.u360-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    overflow: hidden;
    background: rgba(28, 29, 26, 0.08);
    color: inherit;
}
.u360-avatar svg { width: 16px; height: 16px; }
.u360-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.u360-avatar.has-photo { background: #111; }
.u360-avatar--lg { width: 44px; height: 44px; }
.u360-avatar--lg svg { width: 22px; height: 22px; }

.u360-profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(300px, calc(100vw - 24px));
    padding: 12px;
    border-radius: 18px;
    background: #fff;
    color: #141412;
    border: 1px solid rgba(28, 29, 26, 0.08);
    box-shadow: 0 18px 48px rgba(28, 29, 26, 0.16);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
    z-index: 80;
}
.u360-profile-drop.is-open .u360-profile-menu,
.u360-profile-drop:hover .u360-profile-menu,
.u360-profile-drop:focus-within .u360-profile-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
.u360-profile-menu-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 6px 12px;
    border-bottom: 1px solid rgba(28, 29, 26, 0.08);
    margin-bottom: 10px;
}
.u360-profile-menu-meta { min-width: 0; }
.u360-profile-menu-meta strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: #141412;
}
.u360-profile-menu-meta span {
    display: block;
    margin-top: 3px;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(28, 29, 26, 0.55);
}
.u360-profile-balance {
    margin: 0 0 10px;
    padding: 12px;
    border-radius: 14px;
    background: #0e0f12;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.u360-profile-balance span {
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.45);
}
.u360-profile-balance strong {
    display: block;
    margin-top: 4px;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--cab-lime);
}
.u360-profile-balance p {
    margin: 4px 0 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.35;
}
.u360-profile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.u360-profile-menu-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #1c1d1a;
    text-decoration: none;
    transition: background 0.15s;
}
.u360-profile-menu-link:hover { background: #f3f2ef; }
.u360-profile-logout {
    width: 100%;
    margin-top: 10px;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid rgba(28, 29, 26, 0.1);
    background: #f7f6f3;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    color: #b42318;
    cursor: pointer;
    transition: background 0.15s;
}
.u360-profile-logout:hover { background: #fdecec; }

.mh-login--avatar {
    overflow: hidden;
    padding: 0;
}
.mh-login--avatar .u360-avatar {
    width: 28px;
    height: 28px;
}

/* ——— Оболочка кабинета ——— */
body.is-cabinet {
    background: var(--cab-sidebar);
}
body.is-cabinet .site-main {
    min-height: 0;
    background: var(--cab-sidebar);
}
body.is-cabinet .site-footer,
body.is-cabinet .p360-site-footer {
    display: none;
}

.cab-shell {
    display: grid;
    grid-template-columns: var(--cab-sidebar-w) minmax(0, 1fr);
    min-height: calc(100vh - var(--cab-sticky-top));
    background: var(--cab-sidebar);
}

.cab-sidebar {
    background: var(--cab-sidebar);
    color: rgba(255, 255, 255, 0.88);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--cab-sticky-top);
    align-self: start;
    height: calc(100vh - var(--cab-sticky-top));
    max-height: calc(100vh - var(--cab-sticky-top));
    overflow-y: auto;
    box-sizing: border-box;
}
.cab-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1rem;
    padding: 0 8px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 20px;
    color: #fff;
    text-decoration: none;
}
.cab-sidebar-logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    color: var(--cab-lime);
    display: grid;
    place-items: center;
    font-size: 0.62rem;
    font-weight: 800;
    flex-shrink: 0;
}
.cab-sidebar-user {
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 16px;
}
.cab-sidebar-user-name {
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 2px;
    color: #fff;
}
.cab-sidebar-user-meta {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
}
.cab-sidebar-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(16, 185, 129, 0.15);
    color: var(--cab-lime);
}

.cab-sidebar-balance {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.28);
}
.cab-sidebar-balance-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 4px;
}
.cab-sidebar-balance-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--cab-lime);
}
.cab-sidebar-balance-hint {
    margin-top: 4px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.35;
}
.cab-sidebar-balance--locked {
    opacity: 0.85;
}

.cab-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cab-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    text-align: left;
    text-decoration: none;
    box-sizing: border-box;
    transition: background 0.15s, color 0.15s;
}
.cab-nav-link svg {
    width: 18px;
    height: 18px;
    max-width: 18px;
    max-height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
    overflow: visible;
}
button.cab-nav-link {
    appearance: none;
    -webkit-appearance: none;
}
.cab-nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}
.cab-nav-link.is-active {
    background: rgba(16, 185, 129, 0.12);
    color: var(--cab-lime);
}
.cab-nav-link.is-active svg { opacity: 1; }
.cab-nav-link.is-locked {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.cab-sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.cab-nav-link.logout { color: rgba(255, 255, 255, 0.4); }
.cab-nav-link.logout:hover {
    color: #ff8a8a;
    background: rgba(255, 100, 100, 0.08);
}
.cab-logout-form { margin: 0; }

.cab-main {
    padding: 28px 28px 48px;
    min-width: 0;
    background: var(--cab-bg);
    color: var(--cab-text);
}

.cab-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}
.cab-top h1 {
    font-size: clamp(1.4rem, 3vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
    color: var(--cab-text);
}
.cab-top p {
    color: var(--cab-muted);
    font-size: 0.9rem;
    margin: 0;
}
.cab-top-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.cab-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 999px;
    background: var(--cab-lime);
    color: var(--cab-text);
    font-weight: 800;
    font-size: 0.88rem;
    border: none;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.cab-action:hover { background: var(--cab-lime-hover); color: var(--cab-text); }
.cab-action--dark {
    background: #141412;
    color: var(--cab-lime);
}
.cab-action--dark:hover {
    background: #272824;
    color: var(--cab-lime);
}
.cab-action.is-disabled,
.cab-action[aria-disabled="true"] {
    opacity: 0.45;
    pointer-events: none;
}

.cab-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.cab-stat {
    background: var(--cab-white);
    border-radius: var(--cab-radius);
    padding: 18px 20px;
    box-shadow: var(--cab-shadow);
    border: 1px solid var(--cab-border);
}
.cab-stat > span {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cab-muted);
}
.cab-stat strong {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    margin-top: 6px;
    letter-spacing: -0.02em;
    color: var(--cab-text);
}
.cab-stat--balance {
    background: linear-gradient(135deg, #141412 0%, #272824 100%);
    border-color: #141412;
    color: rgba(255, 255, 255, 0.88);
}
.cab-stat--balance > span:first-child { color: rgba(255, 255, 255, 0.55); }
.cab-stat--balance strong {
    color: var(--cab-lime);
    font-size: clamp(1.85rem, 2.6vw, 2.35rem);
    line-height: 1.1;
}
.cab-stat-note {
    display: block;
    margin-top: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.35;
}

.cab-panels {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
}
.cab-panel {
    background: var(--cab-white);
    border-radius: var(--cab-radius);
    padding: 22px;
    box-shadow: var(--cab-shadow);
    border: 1px solid var(--cab-border);
}
.cab-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.cab-panel-head h2 {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
}
.cab-panel-head a {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--cab-muted);
    text-decoration: none;
}
.cab-panel-head a:hover { color: var(--cab-text); text-decoration: underline; }
.cab-empty {
    padding: 12px 0 4px;
}
.cab-empty p {
    margin: 0 0 16px;
    font-size: 0.95rem;
    color: var(--cab-muted);
    line-height: 1.5;
}
.cab-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--cab-border);
    text-decoration: none;
    color: inherit;
}
.cab-list-item:last-child { border-bottom: none; padding-bottom: 0; }
.cab-list-item strong {
    display: block;
    font-size: 0.92rem;
    margin-bottom: 2px;
}
.cab-list-item span {
    font-size: 0.78rem;
    color: var(--cab-muted);
}

body.is-cabinet .cabinet-title {
    margin: 0 0 8px;
    font-size: clamp(1.4rem, 3vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}
body.is-cabinet .cabinet-lead {
    color: var(--cab-muted);
}
body.is-cabinet .dash-card,
body.is-cabinet .card {
    border-radius: var(--cab-radius);
    box-shadow: var(--cab-shadow);
    border: 1px solid var(--cab-border);
}
body.is-cabinet .cabinet-dock {
    left: auto;
    right: 20px;
}

@media (max-width: 1100px) {
    .cab-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    body.is-cabinet { background: var(--cab-bg); }
    body.is-cabinet .site-main { background: var(--cab-bg); }
    .cab-shell {
        grid-template-columns: 1fr;
        min-height: 0;
        background: var(--cab-bg);
    }
    .cab-sidebar { display: none; }
    .cab-main { padding: 16px 16px 96px; }
    .cab-panels { grid-template-columns: 1fr; }
    .cab-top-actions { width: 100%; }
    .cab-action { justify-content: center; }
    body.is-cabinet .cabinet-dock {
        left: 12px;
        right: auto;
    }
}
@media (max-width: 520px) {
    .cab-stats { grid-template-columns: 1fr; }
}
