body, html {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: var(--c-bg);
    /* Запрет масштабирования страницы жестом (pinch/двойной тап): user-scalable=no
       браузеры часто игнорируют. Прокрутка шторок и списков остаётся. */
    touch-action: pan-x pan-y;
}

#map {
    height: 100%;
    width: 100%;
    background-color: var(--c-bg);
    /* Жесты карты (зум/поворот) обрабатывает сама карта */
    touch-action: none;
}


:root {
    --c-bg: #000;
    --c-white: #fff;
    --c-fg-muted: rgba(255, 255, 255, 0.72);
    --c-fg-09: rgba(255, 255, 255, 0.9);
    --c-fg-092: rgba(255, 255, 255, 0.92);
    --c-chip: rgba(255, 255, 255, 0.08);
    --c-weak-color: #ff8b6b;
    --c-strong-bg: rgba(46, 178, 48, 0.18);
    --c-strong-color: #61e06f;
    --c-popup-bg: rgba(18, 18, 18, 0.92);
    --radius-lg: 16px;
    --accent-gradient: linear-gradient(135deg, #2eb230, #1f8122);
    --shadow-elev-3: 0 18px 45px rgba(0, 0, 0, 0.45);
    --status-online-bg: rgba(46, 178, 48, 0.15);
    --status-offline-bg: rgba(255, 120, 71, 0.15);
}

.popup,
.regs-stats-panel {
    border-radius: var(--radius-lg);
    background: var(--c-popup-bg);
    box-shadow: var(--shadow-elev-3);
    color: var(--c-white);
}

.popup {
    position: fixed;
    left: 50%;
    top: 50%;
    display: none;
    transform: translate(-50%, -50%);
    min-width: 240px;
    max-width: 280px;
    padding: 9px 10px 10px;
    line-height: 1.45;
    backdrop-filter: blur(14px);
    pointer-events: auto;
    z-index: 1100;
}

.popup--visible {
    display: flex;
    flex-direction: column;
    gap: 7px;
}


.popup-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
}

.popup-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--c-white);
    text-align: center;
}

.popup-close,
.popup-fav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--c-chip);
    color: var(--c-white);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    outline: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.popup-close { right: 0; font-size: 22px; }
.popup-fav { left: 0; font-size: 16px; }
.popup-fav::before { content: '★'; display: block; transform: translateY(-1px); }
.popup-close:focus, .popup-fav:focus { box-shadow: none; }
.popup-close:hover, .popup-fav:hover { background: rgba(255, 255, 255, 0.16); }
.popup-close:active, .popup-fav:active { background: rgba(255, 255, 255, 0.24); }
.popup-fav:active { transform: translateY(-50%) scale(0.96); }
.popup-fav.is-fav { background: rgba(255, 193, 7, 0.22); }
.popup-fav.is-fav:hover { background: rgba(255, 193, 7, 0.30); }

.popup-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.popup-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.02em;
    background: var(--c-chip);
    color: var(--c-fg-09);
}

.popup-details {
    display: grid;
    gap: 10px;
}

.popup-detail-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
}

.popup-detail-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--c-fg-092);
}

/* removed unused popup input styles */

.button-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.btn-selector,
.mini-btn-selector,
.send-all-select,
.send-all-button,
.send-all-progress,
.regs-select,
.regs-btn,
.node-id-input {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.btn-selector,
.mini-btn-selector,
.status-item--server-error,
.ble-tap {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-selector,
.mini-btn-selector {
    color: var(--c-fg-092);
    font-weight: 600;
    touch-action: manipulation;
}

.btn-selector {
    flex: 1;
    min-width: 50px;
    height: 36px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.mini-btn-selector {
    width: clamp(32px, 8.5vw, 36px);
    aspect-ratio: 1;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-selector.holding,
.mini-btn-selector.holding {
    border-color: rgba(255, 152, 0, 0.8) !important;
    z-index: 1; /* Чтобы свечение было поверх соседей */
    animation: pulse-orange 0.9s ease-in-out infinite !important;
}

.btn-selector--span2 { grid-column: span 2; }

.btn-selector:hover,
.mini-btn-selector:hover,
.send-all-select:hover,
.send-all-button:hover,
.send-all-progress:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-selector:active,
.mini-btn-selector:active {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(1px);
}

.btn-selector.loading,
.mini-btn-selector.loading {
    color: #fff3cd;
    cursor: wait;
    animation: pulse 0.9s ease-in-out infinite;
}

.btn-selector.loading {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.28), rgba(255, 193, 7, 0.12));
    border-color: rgba(255, 193, 7, 0.7);
    opacity: 0.9;
}

.mini-btn-selector.loading {
    background: rgba(255, 193, 7, 0.22);
    border-color: rgba(255, 193, 7, 0.8);
}

.btn-selector.success,
.mini-btn-selector.success {
    background: var(--accent-gradient);
    border-color: var(--c-strong-color);
    color: var(--c-white);
    box-shadow: 0 4px 12px rgba(46, 178, 48, 0.5);
}

.mini-btn-selector.success {
    box-shadow: 0 2px 6px rgba(46, 178, 48, 0.5);
}

.btn-selector.error,
.mini-btn-selector.error {
    background: rgba(255, 120, 71, 0.3);
    border-color: rgba(255, 120, 71, 0.5);
    color: var(--c-weak-color);
}

@keyframes popupUpdateFade {
    0% { background-color: rgba(60, 60, 60, 0.92); }
    100% { background-color: var(--c-popup-bg); }
}

.popup-update-flash {
    animation: popupUpdateFade 0.4s ease-out;
}

.popup-swipe-container {
    display: flex;
    align-items: flex-start;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-top: 12px;
    scroll-behavior: smooth;
}

.popup-swipe-container::-webkit-scrollbar,
div.control-popup::-webkit-scrollbar {
    display: none;
}

.popup-tab-content {
    flex: 0 0 100%;
    min-width: 100%;
    scroll-snap-align: start;
    box-sizing: border-box;
    padding-right: 2px;
}

#popup-tab-history {
    padding-right: 0;
    padding-left: 2px;
    max-height: 200px;
    overflow-y: auto;
}

.popup-history-list {
    font-size: 13px;
}

.popup-history-msg {
    padding: 10px;
    text-align: center;
    color: var(--c-text-sec);
}

.popup-history-msg--error {
    color: var(--c-danger);
}

.popup-history-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.popup-history-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.popup-history-date {
    font-weight: 500;
}

.popup-history-num {
    color: var(--c-text-sec);
    font-size: 11px;
}

.popup-history-meta {
    display: flex;
    justify-content: space-between;
    color: var(--c-text-sec);
    font-size: 12px;
}

.search-result-serial {
    font-weight: 400;
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
}

.ios-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    z-index: 9999;
    border-top: 1px solid #2eb230;
}

.popup-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding-bottom: 4px;
}

.popup-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.2s;
}

.popup-dot.active {
    background: var(--c-accent);
}

.mini-button-selector {
    display: flex;
    gap: 4px;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    70%  { box-shadow: 0 0 0 8px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

@keyframes pulse-orange {
    0%   { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(255, 152, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

div.control-popup {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 86%;
    min-height: 72px;
    margin: 3px 3px 0;
    padding: 5px;
    border-radius: 16px 16px 0 0;
    background: var(--c-popup-bg);
    box-shadow: var(--shadow-elev-3);
    text-align: left;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 900;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    transition: transform 0.1s ease-out;
}

div.control-popup:empty::after {
    content: 'Загрузка';
    margin-top: 10px;
    display: block;
    color: var(--c-fg-muted);
}

div.control-popup img {
    margin: 0;
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: cover;
    display: block;
    touch-action: none;
    z-index: 901;
}
.control-popup.photo-mode { 
    padding: 0; 
    margin: 5px; 
    border-radius: 16px 16px 20px 20px; 
    box-shadow: none; 
    background: var(--c-bg); 
    min-height: 0; 
    max-height: 99%; 
}
.control-popup.photo-mode img { 
    object-fit: contain; 
    background-color: var(--c-bg);
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}
.control-popup.photo-mode .sheet-header,
.control-popup.photo-mode .sheet-list,
.control-popup.photo-mode .separator { display: none; }

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    background: transparent;
    padding: 0;
    z-index: 1;
    cursor: pointer;
}
.sheet-grabber {
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,0.22);
    padding: 0;
}

.sheet-list {
    display: grid;
    gap: 6px;
}
.signal-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}
.signal-card--sent {
    outline: 1px solid rgba(46, 178, 48, 0.55);
    background: rgba(46, 178, 48, 0.10);
    animation: cardPulse 0.75s ease-out 1;
}
.signal-card--error {
    outline: 1px solid rgba(255, 120, 71, 0.55);
    background: rgba(255, 120, 71, 0.10);
    animation: cardPulseError 0.75s ease-out 1;
}
@keyframes cardPulse {
    0%   { box-shadow: 0 0 0 0 rgba(46, 178, 48, 0.0); }
    30%  { box-shadow: 0 0 0 8px rgba(46, 178, 48, 0.18); }
    100% { box-shadow: 0 0 0 14px rgba(46, 178, 48, 0.0); }
}
@keyframes cardPulseError {
    0%   { box-shadow: 0 0 0 0 rgba(255, 120, 71, 0.0); }
    30%  { box-shadow: 0 0 0 8px rgba(255, 120, 71, 0.18); }
    100% { box-shadow: 0 0 0 14px rgba(255, 120, 71, 0.0); }
}
.signal-main,
.signal-info {
    display: flex;
    align-items: center;
    min-width: 0;
}
.signal-main {
    flex: 1;
    gap: 10px;
}
.signal-info {
    flex: 1;
    min-width: 0;
    gap: 8px;
}
.signal-stack {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.signal-title {
    color: var(--c-white);
    font-size: 13px;
    font-weight: 600;
    min-width: 0;
}
.signal-title .hits-counter {
    font-size: 8px;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
    vertical-align: middle;
}
.signal-sub {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
}

.separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
    margin: 6px 8px;
}

.send-all-container {
    padding: 6px 8px;
    margin-bottom: 6px;
}

.send-all-controls {
    display: flex;
    gap: 6px;
}

.send-all-select,
.send-all-button,
.send-all-progress,
.node-id-input {
    height: 40px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.send-all-select,
.send-all-button,
.send-all-progress {
    color: var(--c-fg-092);
    cursor: pointer;
}

.send-all-select {
    flex: 0 0 auto;
    min-width: 100px;
    padding: 0 12px;
    font-weight: 500;
}

.send-all-select:focus {
    background: rgba(255, 255, 255, 0.14);
    border-color: var(--c-strong-color);
    box-shadow: 0 0 0 2px rgba(46, 178, 48, 0.2);
}

.send-all-select option {
    background: #1a1a1a;
    color: var(--c-white);
}

.send-all-button,
.send-all-progress {
    flex: 1;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.send-all-progress {
    display: none;
    position: relative;
    overflow: hidden;
}

.send-all-button:active {
    transform: translateY(1px);
    background: rgba(255, 255, 255, 0.16);
}

.send-all-progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.16);
    transition: width 0.3s ease;
    z-index: 1;
}

.send-all-progress-text {
    position: relative;
    z-index: 2;
    color: var(--c-white);
}

.send-all-container.is-sending .send-all-controls {
    display: none;
}

.send-all-container.is-sending .send-all-progress {
    display: flex;
}

.mapgl-control-container {
    background: #fff;
    box-shadow: 0 1px 3px 0 rgba(38, 38, 38, 0.5);
    border-radius: 4px;
    width: 32px;
    overflow: hidden;
}

.find-me-control {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.find-me-control:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.find-me-control:active {
    background-color: rgba(0, 0, 0, 0.1);
    transform: translateY(1px);
}

.find-me-control:disabled {
    cursor: not-allowed;
    opacity: 0.4;
    pointer-events: none;
}

.find-me-control--no-signal {
    background-color: rgba(255, 87, 51, 0.15);
}

.find-me-control--no-signal:hover {
    background-color: rgba(255, 87, 51, 0.25);
}

.find-me-control--tracking {
    background-color: rgba(33, 150, 243, 0.18);
}

.find-me-control--tracking:hover {
    background-color: rgba(33, 150, 243, 0.28);
}

#findMeControl svg path {
    fill: #616161;
}

#findMeControl.find-me-control--tracking svg path {
    fill: #2196F3;
}

#findMeControl.find-me-control--no-signal svg path {
    fill: #ff5733;
}

.regs-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.regs-select,
.regs-btn {
    height: 36px;
    border-radius: 8px;
    color: var(--c-white);
    font-family: inherit;
    font-size: 13px;
    box-sizing: border-box;
    cursor: pointer;
}

.regs-select {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
}

.regs-select option {
    background: #2a2a2a;
    color: #fff;
}

.regs-stack {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(94vw, 760px);
    max-height: 100vh;
    overflow-y: auto;
    padding: 8px 0;
}

.regs-stack .node-id-modal-content {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

.regs-stack .node-id-modal-title {
    margin: 0 0 10px;
    font-size: 16px;
}

/* Тень каждой карточки (0 18px 45px) ложится на соседа ниже и даёт тёмные полосы между блоками и под ними */
.regs-stack > .regs-stats-panel,
.regs-stack > .node-id-modal-content {
    box-shadow: none;
    padding: 14px 16px;
}

.regs-stats-panel {
    --regs-line: #8ab4ff;
    --regs-warn: #ff8a5c;
    --regs-grid: rgba(255, 255, 255, 0.14);
    --regs-guide: rgba(255, 255, 255, 0.35);
    --regs-gap: rgba(255, 255, 255, 0.6);
    --regs-hover: rgba(255, 255, 255, 0.22);
    --regs-chart-width: 1.2;
    --regs-chart-alpha: 0.40;
    --regs-chart-fill-alpha: 0.14;
    --regs-chart-pad-top: 1;
    --regs-chart-pad-bottom: 1;
    padding: 14px 16px;
    animation: slideUp 0.3s ease-out;
}

.regs-stats-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
}

.regs-stats-sub {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
}

.regs-ble {
    margin-left: auto;
    align-self: center;
    display: inline-flex;
    cursor: pointer;
    padding: 0;
}

.regs-tile,
.regs-rssi-card {
    position: relative;
    overflow: hidden;
    height: 54px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

.regs-rssi-card {
    height: 58px;
    margin-bottom: 6px;
}

.regs-tile-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.regs-tile-top,
.regs-tile-val {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.regs-tile-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px;
}

.regs-tile-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.58);
    white-space: nowrap;
}

.regs-rssi-card .regs-tile-label {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
}

.regs-tile-meta {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.42);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.regs-tile-val {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.regs-tile-val.alert {
    color: var(--regs-warn);
}

.regs-rssi-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 1;
}

.regs-rssi-fill {
    height: 100%;
    width: 0%;
    background: var(--regs-line);
    transition: width 0.08s linear;
}

.regs-metric-tiles {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.regs-tile {
    grid-column: span 2;
}

.regs-tile.span-3 {
    grid-column: span 3;
}

#regs-live-panel .regs-stats-head {
    align-items: center;
}

.regs-live-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
}

.regs-live-tools input[type="range"] {
    width: 90px;
    vertical-align: middle;
}

.regs-mini {
    height: 24px;
    padding: 0 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--c-white);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

.regs-live-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* ровно 3 полоски (3 x 48px + 2 зазора по 4px), остальные - прокруткой вниз */
    max-height: 152px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable; /* появление скроллбара не должно менять ширину уже нарисованных полосок */
}

.regs-strip {
    flex: none;
    padding: 3px 0; /* без боковых отступов: график идёт от края до края полоски */
    overflow: hidden;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
}

.regs-strip-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
    padding: 0 6px; /* отступы только у подписи */
    font-size: 10px;
    line-height: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.regs-strip-warn {
    color: var(--regs-warn);
}

.regs-strip-scroll {
    height: 28px; /* ровно высота canvas; скроллбар скрыт (пакет и так целиком по ширине), жест прокрутки работает */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.regs-strip-tiles {
    display: flex;
    width: max-content;
}

.regs-strip-tiles canvas {
    display: block;
    flex: none;
}

.regs-flags {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column;
    gap: 6px 10px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--c-white);
}

.regs-flags label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.regs-flags input {
    width: 18px;
    height: 18px;
    accent-color: #2eb230;
}

.regs-buttons {
    display: flex;
    gap: 8px;
}

.regs-btn {
    flex: 1;
    font-weight: 600;
}

.regs-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.regs-btn.loading {
    cursor: wait;
    opacity: 0.6;
}

.regs-btn.success {
    background: rgba(46, 178, 48, 0.25);
    border-color: #2eb230;
}

.regs-btn.error {
    background: rgba(255, 87, 51, 0.25);
    border-color: #ff5733;
}

/* Status Bar Styles */
.status-bar {
    position: fixed;
    bottom: calc(15px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(calc(-50% - 20px));
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 800;
    transition: all 0.3s ease;
    flex-wrap: nowrap;
}

.status-bar--hidden {
    opacity: 0;
    transform: translateX(calc(-50% - 20px)) translateY(20px);
    pointer-events: none;
}

.status-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s ease;
    background: var(--status-online-bg);
    color: var(--c-strong-color);
    white-space: nowrap;
    flex-shrink: 0;
}

.status-item--battery-low {
    background: rgba(255, 120, 71, 0.15);
    color: var(--c-weak-color);
}

.status-item--battery-medium {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.status-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.status-description {
    font-size: 14px;
    opacity: 0.7;
    margin-left: 4px;
    white-space: nowrap;
}

.status-item--offline-banner {
    background: var(--status-offline-bg);
    color: var(--c-weak-color);
}

/* Идёт подключение к серверу: серый нейтральный статус вместо оранжевой плашки */
.status-item--connecting {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.65);
}

/* Update notification effect */
.update-indicator {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%) translateX(10px) scale(0.9);
    padding: 4px 0;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--c-white);
    font-size: 13px;
    font-weight: 600;
    z-index: 10;
    opacity: 0;
    transition: right 0.2s ease, opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    max-width: 180px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}

#global-search-input-wrap:has(#global-search-clear[style*="flex"]) .update-indicator {
    right: 36px;
}

.update-indicator--visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0) scale(1);
}

.update-indicator-item[data-key] {
    cursor: pointer;
}

.update-indicator--hiding {
    opacity: 0;
    transform: translateY(-50%) translateX(10px) scale(0.9);
}

.update-indicator-item {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--c-strong-bg);
    color: var(--c-strong-color);
    font-size: 12px;
    font-weight: 500;
}

#global-search-bar {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: min(340px, calc(100% - 24px));
    z-index: 1200;
}

#global-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.global-search-icon {
    position: absolute;
    left: 11px;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    flex-shrink: 0;
}

#global-search-input,
.global-burger-btn,
#global-search-results {
    border-radius: 12px;
    background: var(--c-popup-bg);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-elev-3);
}

#global-search-input {
    width: 100%;
    height: 40px;
    padding: 0 36px 0 14px;
    border: none;
    color: var(--c-white);
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
}

#global-search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

#global-search-clear,
.global-burger-btn {
    border: none;
    color: var(--c-white);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

#global-search-clear {
    position: absolute;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    font-size: 14px;
    line-height: 1;
    display: none;
}

.global-burger-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: flex;
    transition: background 0.2s;
}

.global-burger-btn:hover { background: rgba(255,255,255,0.1); }

#global-search-results {
    margin-top: 6px;
    display: none;
    max-height: 55vh;
    overflow-y: auto;
    scrollbar-width: none;
}

#global-search-results::-webkit-scrollbar { display: none; }

.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover,
.search-result-item:active {
    background: rgba(255, 255, 255, 0.07);
}

.search-result-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.search-result-send {
    flex: 0 0 auto;
    min-width: 0;
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
    text-transform: uppercase;
}

.search-result-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--c-white);
}

.search-result-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
}

/* Node ID Modal Styles */
.node-id-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
}

.node-id-modal.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-id-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.node-id-modal-content {
    position: relative;
    background: var(--c-popup-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 340px;
    box-shadow: var(--shadow-elev-3);
    animation: slideUp 0.3s ease-out;
}

/* Все иконки BLE (.ble-icon) стилизуются одним атрибутом data-ble на <html>, который ставит updateBLEStatus */
@keyframes bleBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.15; }
}
.status-item.ble-tap {
    gap: 5px;
}
.ble-icon {
    display: inline-flex;
    color: rgba(255, 255, 255, 0.4);
}
:root[data-ble="connected"] .ble-icon {
    color: #2196F3;
}
:root[data-ble="connecting"] .ble-icon {
    color: #ffc107;
    animation: bleBlink 0.8s ease-in-out infinite;
}

.status-sep {
    opacity: 0.3;
}

.status-mesh {
    width: 16px;
    height: 16px;
}

.status-mesh--unknown {
    color: rgba(255, 255, 255, 0.4);
}

.status-mesh--direct {
    color: #2196F3;
}

.status-mesh--relay {
    color: #ffc107;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.node-id-modal-title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--c-white);
}

.node-id-modal-description {
    margin: 0 0 16px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
}

.node-id-input {
    width: 100%;
    padding: 0 12px;
    margin-bottom: 8px;
    color: var(--c-white);
    box-sizing: border-box;
}

.node-id-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.node-id-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--c-strong-color);
    box-shadow: 0 0 0 2px rgba(46, 178, 48, 0.2);
}

.node-id-modal-hint {
    margin: 0 0 16px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.node-id-submit {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: var(--accent-gradient);
    color: var(--c-white);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.node-id-submit:hover {
    box-shadow: 0 4px 12px rgba(46, 178, 48, 0.3);
}

.node-id-submit:active {
    transform: translateY(1px);
}

.node-id-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

