/* CCOS Tools — раскладка страниц и навигация */

.site {
    min-height: 100vh;
    padding-top: var(--header-height);
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: var(--layout-content-width);
    margin: 0 auto;
}

/* ШАПКА */

.header {
    position: fixed;
    z-index: 1000;
    top: 0;
    right: 0;
    left: 0;
    background: var(--header-bg);
    color: var(--header-text);
    border-bottom: 1px solid var(--layout-divider);
}

.header-inner {
    width: 100%;
    min-height: var(--header-height);
    padding: 18px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    position: fixed;
    z-index: 1001;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    width: var(--layout-side-menu-width);
    height: var(--header-height);
    padding: 0 24px;
    border-right: 1px solid var(--layout-divider);
    background: var(--header-bg);
    color: var(--header-text);
    text-decoration: none;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.logo-image {
    display: block;
    width: 140px;
    height: auto;
    fill: var(--header-text);
}

/* ОСНОВНАЯ ЧАСТЬ */

.main {
    flex: 1;
    min-width: 0;
    margin-left: var(--layout-side-menu-width);
    padding: 50px 20px 60px;
}

.main > .container {
    max-width: var(--layout-content-width);
}

.main table {
    font-size: 13px;
}

.main th {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* NUMBER INPUT */

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

/* КОНТЕНТ СТРАНИЦ СЕРВИСОВ */

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

/* Страница с дополнительным меню: 280 + 40 + 820 = 1140 px */

.local-subnav-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 820px);
    width: 100%;
    max-width: 1140px;
    gap: 40px;
    margin: 0 auto;
}

.local-subnav {
    position: sticky;
    top: calc(var(--header-height) + 30px);
    align-self: start;
    max-height: calc(100vh - var(--header-height) - 60px);
    padding: 18px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--surface-bg);
}

.local-subnav-title {
    margin-bottom: 12px;
    color: var(--text-color);
    font-size: 13px;
    font-weight: 700;
}

.local-subnav-nav {
    display: grid;
    gap: 2px;
}

.local-subnav-group {
    margin: 12px 12px 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.local-subnav-group:first-child {
    margin-top: 0;
}

.local-subnav-link {
    display: block;
    padding: 9px 12px;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 12px;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.local-subnav-link:hover {
    background: #312e22;
    color: #ffffff;
}

.local-subnav-link.is-active {
    background: #312e22;
    color: #ffd85d;
}

.local-subnav-collapsible + .local-subnav-collapsible { margin-top:4px; }
.local-subnav-collapsible-title { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:9px 12px; border-radius:7px; color:var(--text-color); font-size:12px; font-weight:600; cursor:pointer; list-style:none; transition:background-color .15s,color .15s; }
.local-subnav-collapsible-title::-webkit-details-marker { display:none; }
.local-subnav-collapsible-title:hover { background:#312e22; color:#fff; }
.local-subnav-collapsible-title svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; transition:transform .15s; }
.local-subnav-collapsible[open] > .local-subnav-collapsible-title svg { transform:rotate(90deg); }
.local-subnav-collapsible-links { display:grid; gap:2px; padding:2px 0 4px 10px; }

.local-subnav-content {
    min-width: 0;
    max-width: 820px;
}

@media (max-width: 900px) {
    .local-subnav-layout {
        display: block;
    }

    .local-subnav {
        position: static;
        max-height: none;
        margin-bottom: 24px;
    }
}

.service-content h2 {
    margin: 0 0 5px;
    font-size: 18px;
}

/* Ссылки в карточке */

.service-links {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}

.service-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.service-links a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

/* ==========================================
   CCOS Tools — Главное меню
   ========================================== */

.main-menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    margin-left: 0;
}

.main-menu-left,
.main-menu-right {
    display: flex;
    align-items: center;
}

.main-menu-left {
    position: fixed;
    z-index: 900;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    flex-direction: column;
    align-items: stretch;
    width: var(--layout-side-menu-width);
    gap: 0;
    padding: 20px 0 40px;
    overflow-y: auto;
    border-right: 1px solid var(--layout-divider);
    background: var(--menu-bg);
    color: var(--text-color);
}

.main-menu-right {
    gap: 8px;
    margin-left: auto;
}

.header-rates {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    margin-left: 18px;
    white-space: nowrap;
}

.header-rate {
    display: flex;
    min-width: 86px;
    height: 38px;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border: 1px solid var(--header-secondary-border);
    border-radius: 8px;
    background: var(--header-secondary-bg);
}

.header-rate img {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
    object-fit: contain;
}

.header-rate-content {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.header-rate strong {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .45px;
    line-height: 1;
}

.header-rate [data-header-rate] {
    color: var(--header-text);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.header-rate--rub strong { color: #60a5fa; }
.header-rate--btc strong { color: #fb923c; }
.header-rate--eth strong { color: #8b9cf6; }
.header-rate--sol strong { color: #a78bfa; }

@media (max-width: 1280px) {
    .header-rates {
        display: none;
    }
}

.header .main-menu-right .header-control-secondary {
    height: 38px;
    min-height: 38px;
    padding: 9px 14px;
    border: 1px solid var(--header-secondary-border);
    border-radius: 8px;
    background: var(--header-secondary-bg);
    color: var(--header-secondary-text);
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.15s, border-color 0.15s;
}

.header .main-menu-right .header-control-secondary:hover,
.header .main-menu-right .main-menu-dropdown-open > .header-control-secondary,
.header .main-menu-right .web3-network-dropdown-open > .header-control-secondary {
    border-color: var(--header-secondary-border);
    background: var(--header-secondary-border);
    color: var(--header-secondary-text);
}

.header .main-menu-right .header-icon-button {
    width: 38px;
    min-width: 38px;
    padding: 0;
}

.main-menu-right .web3-network-dropdown {
    order: 1;
}

.main-menu-right .web3-wallet-header {
    order: 2;
}

.main-menu-right .header-preferences {
    order: 3;
}

.main-menu-right .header-theme-button {
    order: 4;
}

.header-preferences-button {
    justify-content: center;
}

.header .main-menu-right .header-preferences-button svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    fill: currentColor;
}

.header-theme-button {
    justify-content: center;
}

.header-theme-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    fill: currentColor;
}

.header-theme-icon-outline {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.header-theme-icon-moon,
html[data-theme="dark"] .header-theme-icon-sun {
    display: none;
}

html[data-theme="dark"] .header-theme-icon-moon {
    display: block;
}

.header-chevron {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: transform 0.2s;
}

.main-menu-dropdown-open .header-chevron,
.web3-network-dropdown-open .header-chevron {
    transform: rotate(180deg);
}

.header-preferences-dropdown {
    display: grid;
    width: 260px;
    min-width: 260px;
    gap: 14px;
}

.header-preferences-field {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 600;
}

.header-preferences-field {
    display: grid;
    gap: 6px;
}

.header-preferences-native-select {
    display: none;
}

.side-menu-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: auto 16px 0;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
}

.side-menu-avatar {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    border-radius: 50%;
    background: #fd7062;
    color: #000000;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    padding-top: 2px;
    box-sizing: border-box;
}

.main-menu-risk { width:8px; height:8px; flex:0 0 8px; margin-left:auto; border-radius:50%; }
.main-menu-risk--warning { background:#f59e0b; }
.main-menu-risk--danger { background:#ef4444; }

.side-menu-profile-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-menu-profile-separator {
    margin-left: -4px;
    color: var(--text-secondary);
}

.side-menu-profile-logout {
    margin-left: -6px;
    color: var(--text-secondary);
    text-decoration: none;
}

.side-menu-profile-logout:hover {
    color: var(--text-color);
}

.main-menu-dropdown {
    position: relative;
}

.main-menu-link {
    display: flex;
    align-items: center;

    gap: 7px;

    padding: 8px 10px;

    border: 0;
    border-radius: 8px;

    background: transparent;

    color: inherit;

    font: inherit;

    text-decoration: none;

    cursor: pointer;

    white-space: nowrap;

    transition:
        background-color 0.2s ease;
}


.main-menu-link:hover,
.main-menu-dropdown-open > .main-menu-link {
    background-color: rgba(0, 0, 0, 0.06);
}

.main-menu-left .main-menu-link {
    position: relative;
    justify-content: flex-start;
    width: auto;
    margin-right: 8px;
    margin-left: 0;
    margin-bottom: 2px;
    padding: 7px 16px 7px 44px;
    border-radius: 0 20px 20px 0;
    color: var(--text-secondary);
    font-size: 12px;
    transition: background-color 0.15s, color 0.15s;
}

.main-menu-left .main-menu-link::before {
    position: absolute;
    top: 50%;
    left: 25px;
    width: 11px;
    height: 1px;
    background: var(--border-color);
    content: '';
    transition: opacity 0.15s;
}

.main-menu-left .main-menu-link:hover,
.main-menu-left .main-menu-link-active {
    background: #312e22;
    color: #ffffff;
}

.main-menu-left .main-menu-link-active {
    color: #ffd85d;
    font-weight: 500;
}

.main-menu-left .main-menu-link:hover::before,
.main-menu-left .main-menu-link-active::before {
    opacity: 0;
}

.side-menu-standalone,
.side-menu-items {
    position: relative;
    padding: 4px 0;
}

.side-menu-standalone {
    padding-bottom: 5px;
}

.side-menu-standalone::before,
.side-menu-items::before {
    position: absolute;
    top: -5px;
    bottom: -5px;
    left: 25px;
    width: 1px;
    background: var(--border-color);
    content: '';
}

.side-menu-standalone::before {
    top: 50%;
}

.side-menu-section {
    position: relative;
    margin-top: 0;
}

.side-menu-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 16px;
    color: var(--text-color);
    font-size: 13px;
    font-weight: 600;
}

.side-menu-section-title svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.side-menu-section-title .side-menu-section-icon {
    fill: currentColor;
    stroke: none;
}

.side-menu-section-last .side-menu-items::before {
    bottom: 20px;
}


/* ==========================================
   СТРЕЛКА
   ========================================== */

.main-menu-arrow {
    display: flex;

    width: 10px;
    height: 6px;
}


.main-menu-arrow img {
    display: block;

    width: 10px;
    height: 6px;
}


/* ==========================================
   DROPDOWN
   ========================================== */

.main-menu-dropdown-content {
    position: absolute;

    top: calc(100% + 5px);
    right: 0px;

    min-width: max-content;

    padding: 20px;

    background: var(--surface-bg);

    color: var(--text-color);

    border: 1px solid var(--border-color);
    border-radius: 8px;

    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.14);

    opacity: 0;
    visibility: hidden;

    transform: translateY(-4px);

    transition:
        opacity 0.15s ease,
        visibility 0.15s ease,
        transform 0.15s ease;

    z-index: 1000;
}


.main-menu-dropdown-open
.main-menu-dropdown-content {
    opacity: 1;
    visibility: visible;

    transform: translateY(0);
}


.main-menu-dropdown-content > a {
    display: block;

    padding: 9px 12px;

    border-radius: 6px;

    color: var(--text-color);

    font-size: 14px;

    line-height: 1.3;

    text-decoration: none;

    white-space: nowrap;
}


.main-menu-dropdown-content > a:hover {
    background-color: #f1f1f1;
}


/* ==========================================
   ЛОГИН ПОЛЬЗОВАТЕЛЯ
   ========================================== */


/* СТРАНИЦЫ 403 И 404 */

	.error-code {
		font-size: 200px;
		font-weight: 700;
	}

/* ТЕМА КОМПОНЕНТОВ */

.header { background: var(--header-bg); color: var(--header-text); }
.subtitle,
.service-content p,
.field-help { color: var(--text-muted); }

/* Дополнительные цвета темы */


.header .main-menu-link:hover,
.header .main-menu-dropdown-open > .main-menu-link {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: transparent;
    color: var(--header-text);
}

.header .main-menu-left .main-menu-link:hover,
.header .main-menu-left .main-menu-link-active {
    background: #312e22;
    color: #ffffff;
}

.header .main-menu-left .main-menu-link-active {
    color: #ffd85d;
}



/* ==========================================
   ДОПОЛНЕНИЯ — НАСТРОЙКИ, ПАРОЛИ И МЕНЮ
   ========================================== */

/* ТЕМНАЯ ТЕМА — ОБЩИЕ СОСТОЯНИЯ */

html[data-theme="dark"] .service-links a,
html[data-theme="dark"] .service-links a:hover { color: var(--text-color); }

html[data-theme="dark"] .main-menu-dropdown-content > a:hover { background: var(--surface-hover); color: var(--text-color); }

html[data-theme="dark"] button:disabled:not(.ui-button),
html[data-theme="dark"] button:disabled:not(.ui-button):hover,
html[data-theme="dark"] button:disabled:not(.ui-button):active { opacity: 0.5; }

html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-color);
    -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
    caret-color: var(--text-color);
}
