/* Индикаторы шапки: баланс магазинов и курс (header-indicators.js).
 * Единая панель: индикаторы и соседние кнопки шапки («?», уведомления, язык)
 * одной высоты, с одинаковым фоном, рамкой и скруглением. */
.hdr-ind-root { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; margin-left: 12px; }
.hdr-ind-root:empty { display: none; }
.hdr-ind { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; box-sizing: border-box;
           border-radius: 9px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06);
           color: #fff; cursor: pointer; font: inherit; line-height: 1.1; text-align: left; white-space: nowrap;
           transition: background .15s ease, border-color .15s ease; }
.hdr-ind:hover, .hdr-ind[aria-expanded="true"] { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .3); }
.hdr-ind:focus-visible { outline: 2px solid #8fb8ff; outline-offset: 1px; }
.hdr-ind-balance { box-shadow: inset 3px 0 0 #28a745; }
.hdr-ind-rate { box-shadow: inset 3px 0 0 #4ea1ff; }
.hdr-ind-icon { font-size: 18px; line-height: 1; }
.hdr-ind-text { display: inline-flex; flex-direction: column; justify-content: center; }
.hdr-ind-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: #adb5bd; }
.hdr-ind-value { font-size: 14px; font-weight: 600; }

/* Десктоп и планшет: одна строка — индикаторы слева, кнопки пользователя справа. */
@media (min-width: 768px) {
    #container #header { flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between;
                         gap: 16px; padding: 8px 20px; }
    #container #header #branding { float: none; display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
                                   flex: 1 1 auto; min-width: 0; }
    #container #header #branding .hdr-ind-root { margin-left: 0; }
    #container #header #user-tools { float: none; display: flex; align-items: center; gap: 8px; margin: 0;
                                     flex: 0 0 auto; text-align: left; line-height: 1; }
    #container #header #user-tools .dropdown { padding: 0 !important; background: transparent !important;
                                               box-shadow: none; }
    #container #header #user-tools .hdr-tools-main { display: inline-flex; gap: 8px; }
    #container #header #user-tools .btn-button { margin: 0; }
}

/* кнопки шапки — одна высота, фон, рамка и скругление */
#header .hc-trigger,
#header .pn-bell,
#header #lang-switcher-toggle,
#header #dark-mode-toggle,
#header .hdr-profile-toggle { height: 38px; min-width: 38px; box-sizing: border-box; border-radius: 9px;
                              border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06);
                              color: #fff; }
#header #dark-mode-toggle { display: inline-flex; align-items: center; justify-content: center;
                            padding: 0 !important; width: 38px; font-size: 17px !important; }

/* профиль: аватар-инициал + стрелка, меню с логином, настройками и выходом */
.hdr-profile-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px 0 4px; cursor: pointer;
                      font: inherit; text-transform: none; letter-spacing: 0; }
.hdr-profile-toggle:hover, .hdr-profile-toggle[aria-expanded="true"] { background: rgba(255, 255, 255, .14) !important; }
.hdr-profile-name { display: none; }
.hdr-profile-avatar { order: -1; display: inline-flex; align-items: center; justify-content: center; width: 28px;
                      height: 28px; border-radius: 50%; background: #4750D1; color: #fff; font-size: 14px;
                      font-weight: 700; }
.hdr-profile-caret { width: 10px; height: 10px; opacity: .7; }
.hdr-profile-menu { position: fixed; z-index: 99999; min-width: 200px; padding: 4px; background: #1e1e2e;
                    border: 1px solid rgba(255, 255, 255, .12); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
                    text-transform: none; letter-spacing: 0; font-size: 13px; }
.hdr-profile-menu[hidden] { display: none; }
.hdr-profile-head { padding: 8px 12px 6px; color: #adb5bd; font-size: 12px; border-bottom: 1px solid rgba(255, 255, 255, .08);
                    margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#header .hdr-profile-menu a, .hdr-profile-menu a { display: flex; align-items: center; gap: 8px; padding: 8px 12px;
                                                   border-radius: 5px; border: 0; color: #fff; text-decoration: none; }
#header .hdr-profile-menu a:hover, .hdr-profile-menu a:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.hdr-ind-mobile { display: none; }

/* мобильная шапка: одна строка — бургер, баланс, курс, «?», уведомления, пользователь.
 * Индикаторы той же высоты, что соседние кнопки; вместо иконки — цветная рамка. */
.mm-header-info .hdr-ind-root { margin-left: 0; gap: 4px; flex-shrink: 0; }
.mm-header-info .hdr-ind { height: 40px; padding: 0 7px; gap: 0; box-shadow: none; }
.mm-header-info .hdr-ind-balance { border-color: rgba(40, 167, 69, .75); }
.mm-header-info .hdr-ind-rate { border-color: rgba(78, 161, 255, .75); }
.mm-header-info .hdr-ind-icon,
.mm-header-info .hdr-ind-text { display: none; }
.mm-header-info .hdr-ind-mobile { display: inline-flex; flex-direction: column; justify-content: center; }
.hdr-ind-mobile-label { font-size: 9px; letter-spacing: .03em; text-transform: uppercase; color: #adb5bd; }
.hdr-ind-mobile-value { font-size: 12px; font-weight: 700; }
/* вся строка мобильной шапки — кнопки 40px */
.mm-header .pn-bell,
.mm-header .hc-trigger { width: 40px !important; height: 40px !important; min-width: 40px; min-height: 40px;
                        border-radius: 9px; }
.mm-header .mm-header-info { padding: 0 4px; }

.hdr-pop { position: fixed; z-index: 10050; width: 380px; max-width: calc(100vw - 16px); max-height: 70vh;
           overflow: auto; background: #fff; color: #333; border: 1px solid #ddd; border-radius: 10px;
           box-shadow: 0 10px 30px rgba(0, 0, 0, .18); font-size: 13px; }
.hdr-pop-center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%);
                  width: calc(100vw - 24px); max-width: 420px; max-height: 80vh; }
.hdr-pop-backdrop { position: fixed; inset: 0; z-index: 10049; background: rgba(0, 0, 0, .45); }
.hdr-pop-close { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 22px;
                 line-height: 1; color: #888; cursor: pointer; padding: 4px 8px; }
.hdr-pop-body { padding: 14px 16px 12px; }
.hdr-pop-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; padding-right: 28px; }
.hdr-pop-total { font-size: 20px; font-weight: 700; }
.hdr-pop-currencies { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; font-size: 12px; color: #666; }
.hdr-pop-currency-select { padding: 4px 8px; border: 1px solid #ccc; border-radius: 6px; background: #fff;
                           font-size: 13px; min-height: 30px; }
.hdr-pop-bycur { font-size: 12px; color: #666; margin-top: 2px; }
.hdr-pop-note { margin: 6px 0 10px; font-size: 11px; color: #8a6d3b; background: #fff8e1; border-radius: 6px;
                padding: 6px 8px; }
.hdr-pop-list { display: flex; flex-direction: column; gap: 8px; }
.hdr-pop-merchant { border-top: 1px solid #eee; padding-top: 8px; }
.hdr-pop-merchant-head { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.hdr-pop-merchant-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-pop-merchant-total { white-space: nowrap; }
.hdr-pop-coins { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: center; }
.hdr-pop-coin { background: #eef4f7; border-radius: 10px; padding: 1px 8px; font-size: 12px; white-space: nowrap; }
.hdr-pop-coin b { color: #417690; }
.hdr-pop-coin-fiat { color: #888; }
/* Отрицательный баланс */
.hdr-pop-total.is-negative, .hdr-pop-merchant-total.is-negative { color: #c62828; }
.hdr-pop-coin.is-negative { background: #fdecea; color: #c62828; }
.hdr-pop-coin.is-negative b, .hdr-pop-coin.is-negative .hdr-pop-coin-fiat { color: #c62828; }
.hdr-ind-balance.is-negative .hdr-ind-value, .hdr-ind-balance.is-negative .hdr-ind-mobile-value { color: #ff8a80; }
.hdr-pop-merchant-link { margin-left: auto; font-size: 12px; white-space: nowrap; }
.hdr-pop-empty { color: #888; font-size: 12px; }
.hdr-pop-rates { width: 100%; border-collapse: collapse; }
.hdr-pop-rates th, .hdr-pop-rates td { padding: 5px 0; border-bottom: 1px solid #eee; text-align: left;
                                       font-size: 13px; background: none; }
.hdr-pop-rates td { text-align: right; font-weight: 600; }
.hdr-pop-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.hdr-pop-btn { display: inline-block; padding: 7px 12px; border-radius: 6px; border: 1px solid #ccc;
               background: #f7f7f7; color: #333; cursor: pointer; font-size: 13px; text-decoration: none; }
.hdr-pop-btn:hover { background: #eee; color: #036; }
.hdr-pop-btn-primary { background: #28a745; border-color: #28a745; color: #fff !important; font-weight: 600; }
.hdr-pop-btn-primary:hover { background: #218838; }
.hdr-pop-btn.is-loading { opacity: .6; cursor: progress; }
.hdr-pop-btn-short { display: none; }
@media (max-width: 767px) {
    .hdr-pop-btn-history .hdr-pop-btn-full { display: none; }
    .hdr-pop-btn-history .hdr-pop-btn-short { display: inline; }
}
.hdr-pop-updated { margin-left: auto; font-size: 11px; color: #999; }
.hdr-pop-error { flex-basis: 100%; font-size: 12px; color: #c62828; }
.hdr-pop-close { position: sticky; float: right; top: 0; z-index: 1; min-width: 44px; min-height: 44px; }
.hdr-pop-title { padding-right: 0; }
@media (max-width: 767px) {
    .hdr-pop-btn { min-height: 44px; display: inline-flex; align-items: center; }
    .hdr-pop-currency-select { min-height: 40px; }
}

[data-theme="dark"] .hdr-pop { background: var(--dt-bg-module) !important; color: var(--dt-text-primary) !important;
                               border-color: var(--dt-border) !important; }
[data-theme="dark"] .hdr-pop-note { background: #3a3520 !important; color: #fde68a !important; }
[data-theme="dark"] .hdr-pop-merchant,
[data-theme="dark"] .hdr-pop-rates th,
[data-theme="dark"] .hdr-pop-rates td { border-color: var(--dt-border) !important; color: var(--dt-text-primary) !important; }
[data-theme="dark"] .hdr-pop-currency-select { background: var(--dt-bg-input) !important; color: var(--dt-text-primary) !important; border-color: var(--dt-border) !important; }
[data-theme="dark"] .hdr-pop-currencies { color: var(--dt-text-secondary) !important; }
[data-theme="dark"] .hdr-pop-bycur { color: var(--dt-text-secondary) !important; }
[data-theme="dark"] .hdr-pop-coin { background: var(--dt-bg-input) !important; color: var(--dt-text-primary) !important; }
[data-theme="dark"] .hdr-pop-coin b { color: var(--dt-link) !important; }
[data-theme="dark"] .hdr-pop-btn { background: var(--dt-bg-input) !important; color: var(--dt-text-primary) !important;
                                   border-color: var(--dt-border) !important; }
[data-theme="dark"] .hdr-pop-btn-primary { background: #28a745 !important; border-color: #28a745 !important; color: #fff !important; }

/* Плашка JS DEBUG суперпользователя не перекрывает индикаторы шапки. */
#js-debug-toggle { top: auto !important; bottom: 10px !important; }

/* Мобильная шапка: один ритм отступов. Кнопки («поиск», «?», уведомления, профиль)
 * раньше несли каждая свой margin (6/3/8/4 px), и после появления поиска индикаторы
 * баланса и курса не помещались на 360 px. Блок индикаторов растягивается (flex: 1),
 * поэтому кнопкам достаточно одинакового зазора; селекторы с .mm-active сильнее
 * правил модулей кнопок. */
@media (max-width: 767px) {
    .mm-active .mm-header { padding: 0 6px; }
    .mm-active .mm-header .mm-header-info { padding: 0 4px; gap: 4px; }
    .mm-active .mm-header .ps-trigger--mobile,
    .mm-active .mm-header .hc-trigger,
    .mm-active .mm-header .pn-bell--mobile,
    .mm-active .mm-header .mm-header-user { margin: 0 0 0 4px !important; }
}

/* Узкие телефоны (360–420 px): кнопки 36 px, индикаторы плотнее. */
@media (max-width: 420px) {
    .mm-active .mm-header .mm-burger { width: 32px; height: 32px; }
    .mm-active .mm-header .ps-trigger--mobile,
    .mm-active .mm-header .hc-trigger,
    .mm-active .mm-header .pn-bell--mobile,
    .mm-active .mm-header .mm-header-user {
        width: 36px !important; height: 36px !important; min-width: 36px !important; min-height: 36px !important;
    }
    .mm-active .mm-header .ps-trigger--mobile svg,
    .mm-active .mm-header .hc-trigger svg { width: 18px; height: 18px; }
    .mm-active .mm-header .mm-header-user { font-size: 15px; }
    .mm-header-info .hdr-ind { height: 36px; padding: 0 5px; }
    .hdr-ind-mobile-label { font-size: 8.5px; letter-spacing: 0; }
    .hdr-ind-mobile-value { font-size: 11.5px; }
}

/* На 320 px значения и валюты занимают отдельные строки внутри прежних
 * touch targets; прежняя детализация сумм и курсов доступна в popover. */
@media (max-width: 420px) {
    .mm-header-info .hdr-ind-root { flex: 1 1 0; min-width: 0; width: 100%; }
    .mm-header-info .hdr-ind { flex: 1 1 0; min-width: 0; padding: 0 3px; }
    .mm-header-info .hdr-ind-mobile { width: 100%; text-align: center; }
    .mm-header-info .hdr-ind-mobile-value { font-size: 9.5px; line-height: 1.05; white-space: normal; }
}
[data-theme="dark"] .hdr-pop-total.is-negative, [data-theme="dark"] .hdr-pop-merchant-total.is-negative { color: #f87171 !important; }
[data-theme="dark"] .hdr-pop-coin.is-negative,
[data-theme="dark"] .hdr-pop-coin.is-negative b,
[data-theme="dark"] .hdr-pop-coin.is-negative .hdr-pop-coin-fiat { background: rgba(248, 113, 113, 0.14) !important; color: #f87171 !important; }
