* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-login:hover {
    background: #764ba2;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #2c3e50;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.admin-badge {
    background: #f39c12;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.btn-logout {
    background: #e74c3c;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #c0392b;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.card h2 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.status-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #667eea;
    margin-bottom: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.status-box pre {
    font-size: 12px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.btn-refresh {
    background: #27ae60;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-refresh:hover {
    background: #229954;
}

.inline-status {
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 5px;
    font-size: 12px;
}

.inline-status.ok {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.inline-status.err {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.actions-cell {
    white-space: nowrap;
}

.btn-action {
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 11px;
    cursor: pointer;
    margin-right: 6px;
}

.btn-action:last-child {
    margin-right: 0;
}

.btn-action:hover {
    background: #2d80b9;
}

.btn-action-warning {
    background: #e67e22;
}

.btn-action-warning:hover {
    background: #ca6d1c;
}

.last-update {
    text-align: center;
    margin-top: 20px;
    color: #7f8c8d;
    font-size: 14px;
}

.alert {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@media (max-width: 768px) {
    .status-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar {
    position: sticky;
    top: 0;
    z-index: 10;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .nav-right {
        width: 100%;
        justify-content: space-between;
    }
}


.table-wrap {
    width: 100%;
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: #f1f3f5;
    border-bottom: 1px solid #e1e4e8;
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
}

.data-table tbody td {
    border-bottom: 1px solid #eef1f4;
    padding: 6px 8px;
    white-space: nowrap;
}

.data-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.summary {
    font-size: 12px;
    color: #2c3e50;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.empty {
    color: #7f8c8d;
    font-size: 12px;
}


.view-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.devices-status-box {
    height: clamp(700px, calc(100vh - 250px), 1600px);
    max-height: none;
    resize: vertical;
}

.devices-source-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.src-tab {
    border: 1px solid #d0d7de;
    background: #fff;
    color: #2c3e50;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
}

.src-tab.active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

.devices-table {
    font-size: 11px;
}

.devices-table thead th,
.devices-table tbody td {
    padding: 4px 6px;
}

.devices-table .actions-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.devices-table .btn-action,
.devices-table .btn-action-warning {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    padding: 5px 8px;
    margin: 0;
}

.devices-table .btn-action {
    background: #3498db;
}

.devices-table .btn-action:hover {
    background: #2d80b9;
}

.devices-table .btn-action-warning {
    background: #e67e22;
}

.devices-table .btn-action-warning:hover {
    background: #ca6d1c;
}

.tab {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #e1e4e8;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.tab.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.card.hidden {
    display: none;
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .status-grid {
        grid-template-columns: 1fr;
    }

    .status-box {
        max-height: 60vh;
    }

    .devices-status-box {
        height: auto;
        min-height: 55vh;
        max-height: 70vh;
        resize: none;
    }

    .devices-source-tabs {
        flex-wrap: wrap;
    }

    .data-table {
        font-size: 11px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 4px 6px;
    }

    .navbar {
    position: sticky;
    top: 0;
    z-index: 10;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .nav-right {
        width: 100%;
        justify-content: space-between;
    }
}


@media (max-width: 768px) {
    .devices-table th,
    .devices-table td {
        display: none;
    }

    .devices-table th:nth-child(1),
    .devices-table td:nth-child(1),
    .devices-table th:nth-child(3),
    .devices-table td:nth-child(3),
    .devices-table th:nth-child(4),
    .devices-table td:nth-child(4),
    .devices-table th:nth-child(7),
    .devices-table td:nth-child(7),
    .devices-table th:nth-child(9),
    .devices-table td:nth-child(9),
    .devices-table th:nth-child(13),
    .devices-table td:nth-child(13),
    .devices-table th:nth-child(14),
    .devices-table td:nth-child(14) {
        display: table-cell;
    }
}


.btn-password {
    background: #3498db;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-password:hover {
    background: #2d80b9;
}

.password-card {
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}


.btn-password {
    pointer-events: auto;
}


.auto-refresh {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 12px;
}

.auto-refresh input {
    accent-color: #2ecc71;
}
.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 16px;
    padding: 16px;
}

.channel-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.channel-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.channel-info {
    flex: 1;
    margin-bottom: 12px;
}

.channel-name {
    font-size: 14px;
    color: #333;
    word-break: break-all;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
}

.channel-name strong {
    color: #667eea;
    display: block;
    margin-bottom: 4px;
}

.channel-meta {
    font-size: 11px;
    color: #999;
    line-height: 1.4;
}

.channel-actions {
    display: flex;
    gap: 8px;
}

.channel-hangup-btn {
    background: #e67e22;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.3s;
    flex: 1;
}

.channel-hangup-btn:hover {
    background: #d35400;
}

.channel-hangup-btn:active {
    background: #c23000;
}

@media (max-width: 768px) {
    .channels-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }

    .channel-card {
        padding: 12px;
    }
}