/* Панели команд - единый размер для всех */
.panels-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 8px 0;
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    align-content: flex-start;
}

.panel {
    background: linear-gradient(145deg, #1a1f24, #12171b);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    height: fit-content;
    min-height: 200px;
    width: calc(20% - 9.6px);
    min-width: 600px;
    border: 1px solid rgba(66, 153, 225, 0.15);
    transition: all 0.2s ease;
}

.panel:hover {
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #2a3a4a;
    min-height: 32px;
}

.panel-header .device-count-badge {
    background: #1e2a36;
    color: #94a3b8;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 9px;
    margin-left: 8px;
    font-weight: normal;
}

.panel-title {
    font-size: 13px;
    font-weight: 600;
    color: #7dd3fc;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
    letter-spacing: -0.2px;
}

.panel-title:hover {
    opacity: 0.85;
    color: #bae6fd;
}

.panel-icon {
    font-size: 14px;
}

.team-controls {
    display: flex;
    gap: 4px;
}

.team-btn {
    background: #1e2a36;
    border: none;
    color: #94a3b8;
    border-radius: 6px;
    cursor: pointer;
    font-size: 10px;
    padding: 4px 8px;
    line-height: 1;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.team-btn:hover {
    background: #2d3b4a;
    color: #e2e8f0;
    transform: translateY(-1px);
}

.edit-team-btn {
    color: #7dd3fc;
}

.delete-team-btn {
    color: #fca5a5;
}

/* Единая сетка для всех - 4 колонки одинаковой ширины */
.panel-devices.four-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
}

.device-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.column-header {
    font-weight: 600;
    color: #94a3b8;
    text-align: center;
    padding: 5px;
    border-bottom: 1px solid #2a3a4a;
    margin-bottom: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0e1217;
    border-radius: 6px 6px 0 0;
    white-space: nowrap;
}

.device-column > div:not(.column-header) {
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    margin: 0;
    background: #0e1217;
    border: 1px solid #1e2a36;
    border-radius: 6px;
    box-sizing: border-box;
    width: 100%;
    transition: all 0.15s ease;
    overflow: hidden;
}

.device-column > div:not(.column-header):hover {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.05);
}

/* ID устройства (SIP) */
.device-id-item {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-weight: 600;
    color: #e2e8f0;
    font-size: 12px;
    text-align: left;
    padding: 4px 8px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    box-sizing: border-box;
}

/* SIP: контейнер + кнопка копирования (как в Telegram) */
.device-id-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.device-id-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sip-copy-btn {
    margin-left: auto;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1px solid rgba(56, 189, 248, 0.25);
    background: rgba(30, 42, 54, 0.65);
    color: #7dd3fc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-1px);
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.device-id-item:hover .sip-copy-btn {
    opacity: 1;
    transform: translateY(0);
}

.sip-copy-btn:hover {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.5);
}

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

.sip-copy-btn.copied {
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.55);
    background: rgba(16, 185, 129, 0.12);
    opacity: 1;
}

/* Статусы */
.status-item {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}

.status-item.working {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.2)) !important;
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
}

.status-item.not-working {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.2)) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
}

.status-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
    filter: brightness(1.1);
}

/* Номер телефона */
.phone-item {
    font-size: 11px;
}

.phone-item.clickable {
    cursor: pointer;
}

.phone-item.clickable:hover {
    border-color: #38bdf8 !important;
    background: rgba(56, 189, 248, 0.1) !important;
    transform: translateY(-1px) !important;
}

.phone-badge {
    display: inline-block;
    background: #1e2a36;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 11px;
    color: #7dd3fc;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

/* Селект сотрудников */
.worker-select {
    background: #0f0f0f;
    color: white;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    width: 100%;
    height: 36px;
    cursor: pointer;
    outline: none;
}

.worker-select:hover {
    border-color: #3b82f6;
}

.worker-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Пустые значения */
[style*="color: #64748b"] {
    color: #94a3b8 !important;
    font-style: italic;
}

/* Нет устройств */
.no-devices-panel {
    grid-column: 1 / -1;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    padding: 16px;
    background: #0e1217;
    border-radius: 8px;
    border: 1px dashed #2a3a4a;
}

/* Попап выбора статуса */
.status-select-popup {
    position: fixed;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid #2a3a4a;
    border-radius: 12px;
    padding: 10px;
    z-index: 1000;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    max-height: 350px;
    overflow-y: auto;
    min-width: 250px;
    font-size: 12px;
    backdrop-filter: blur(8px);
}

.status-option {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 8px;
    margin: 3px 0;
    color: #e2e8f0;
    font-size: 12px;
    line-height: 1.4;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.status-option:hover {
    background: #1e2a36;
    border-color: #38bdf8;
    transform: translateX(4px);
}

.status-option.working {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid #10b981;
}

.status-option.working:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

.status-option.not-working {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid #ef4444;
}

.status-option.not-working:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.status-option.selected {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    font-weight: 600;
}

.status-select-popup::-webkit-scrollbar {
    width: 5px;
}

.status-select-popup::-webkit-scrollbar-track {
    background: #0e1217;
    border-radius: 3px;
}

.status-select-popup::-webkit-scrollbar-thumb {
    background: #38bdf8;
    border-radius: 3px;
}

/* Подсветка поиска */
.device-item.highlighted {
    border: 2px solid #fbbf24 !important;
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.5);
    background: linear-gradient(145deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.25)) !important;
    position: relative;
    transform: scale(1.02);
    z-index: 10;
}

.device-item.highlighted::after {
    content: '🔍';
    position: absolute;
    top: -12px;
    right: -12px;
    font-size: 12px;
    background: #fbbf24;
    color: #000;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    border: 2px solid #fff;
    font-weight: bold;
}

.panel.has-highlighted {
    border: 1px solid #fbbf24;
    box-shadow: 0 0 25px rgba(251, 191, 36, 0.25);
}

.panel.has-highlighted .panel-header {
    border-bottom-color: #fbbf24;
    background: rgba(251, 191, 36, 0.05);
}

.panel.has-highlighted .panel-title {
    color: #fbbf24;
}

/* Поле поиска */
#deviceSearch {
    background: #0a0c0f;
    color: white;
    border: 1px solid #2a3a4a;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 11px;
    height: 32px;
    min-width: 220px;
    outline: none;
    transition: all 0.2s;
}

#deviceSearch:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}