* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background: white;
}

/* Screens */
.screen {
    display: none;
    padding: 20px;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-card {
    text-align: center;
    padding: 40px 20px;
}

.logo {
    font-size: 4rem;
    margin-bottom: 20px;
}

.login-card h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #1a1a2e;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.input-group input, .input-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
}

.input-group input:focus, .input-group textarea:focus {
    outline: none;
    border-color: #e94560;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #e94560;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #d63a54;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-small {
    background: #e94560;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
}

.error-message {
    background: #ffe0e0;
    color: #e94560;
    padding: 10px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 0.85rem;
}

.hidden {
    display: none;
}

/* Status Bar */
.status-bar {
    background: #1a1a2e;
    color: white;
    padding: 12px 15px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.status-item {
    font-size: 0.8rem;
}

.status-label {
    opacity: 0.7;
}

.status-value {
    font-weight: bold;
    margin-left: 5px;
}

.status-value.connected {
    color: #06d6a0;
}

.status-value.disconnected {
    color: #e94560;
}

.status-value.checking {
    color: #ffd166;
}

/* User Info */
.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.btn-logout {
    background: none;
    border: none;
    color: #e94560;
    cursor: pointer;
    font-size: 0.85rem;
}

/* Section Title */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 20px 0 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Button Grid */
.button-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.btn-hardware {
    background: #f0f2f5;
    border: 1px solid #ddd;
    padding: 15px 5px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-hardware:hover {
    background: #e94560;
    color: white;
    border-color: #e94560;
}

.btn-hardware:active {
    transform: scale(0.98);
}

.btn-hardware.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.custom-grid .btn-hardware {
    background: #fff3e0;
    border-color: #ffd166;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #eee;
}

.modal-footer .btn {
    flex: 1;
}

.device-list {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.device-item {
    background: #f0f2f5;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
}

.device-item:hover {
    background: #e0e0e0;
}

.device-name {
    font-weight: bold;
}

.device-id {
    font-size: 0.7rem;
    color: #666;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.note {
    font-size: 0.7rem;
    color: #888;
    margin-top: 5px;
}

/* Command Queue Indicator */
.queue-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1a1a2e;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
}

/* Responsive */
@media (max-width: 480px) {
    .button-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .status-bar {
        flex-direction: column;
        gap: 5px;
    }
}