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

        body {
            background: #3d3d3d;
            font-family: 'Segoe UI', 'MS Sans Serif', Arial, sans-serif;
            font-size: 11px;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            padding: 10px;
        }

        /* Главное окно - стиль Windows Forms */
        .window {
            background: #f0f0f0;
            border: 1px solid #a0a0a0;
            box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4);
            width: 780px;
            max-width: 98vw;
            border-radius: 0;
        }

        /* Заголовок окна */
        .window-title {
            background: linear-gradient(180deg, #e8e8e8 0%, #d0d0d0 100%);
            padding: 4px 8px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 26px;
            border-bottom: 1px solid #a0a0a0;
            cursor: default;
            user-select: none;
        }

        .window-title span {
            color: #1a1a1a;
            font-weight: 600;
            font-size: 11px;
            font-family: 'Segoe UI', Arial, sans-serif;
        }

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

        .window-controls button {
            background: #f0f0f0;
            border: 1px solid #a0a0a0;
            color: #1a1a1a;
            font-size: 9px;
            width: 18px;
            height: 18px;
            cursor: pointer;
            font-weight: bold;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Segoe UI', Arial, sans-serif;
            padding: 0;
            line-height: 1;
            border-radius: 0;
        }

        .window-controls button:hover {
            background: #e0e0e0;
        }

        .window-controls button:active {
            background: #c0c0c0;
        }

        .window-body {
            padding: 4px;
            background: #f0f0f0;
        }

        /* Панель инструментов */
        .toolbar {
            background: #f0f0f0;
            padding: 4px 6px;
            border-bottom: 1px solid #b0b0b0;
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            align-items: center;
            min-height: 28px;
            margin-bottom: 4px;
        }

        .btn {
            background: #f0f0f0;
            border: 1px solid #a0a0a0;
            padding: 2px 12px;
            font-family: 'Segoe UI', Arial, sans-serif;
            font-size: 11px;
            cursor: pointer;
            color: #1a1a1a;
            min-width: 70px;
            height: 24px;
            border-radius: 2px;
            transition: background 0.15s;
        }

        .btn:hover {
            background: #e8e8e8;
            border-color: #808080;
        }

        .btn:active {
            background: #d0d0d0;
            border-color: #606060;
        }

        .btn:disabled {
            opacity: 0.5;
            cursor: default;
        }

        .btn-primary {
            background: #e0e0e0;
            font-weight: 600;
            border-color: #808080;
        }

        .btn-primary:hover {
            background: #d5d5d5;
        }

        .btn-flash {
            background: #d0d0d0;
            color: #1a1a1a;
            font-weight: 600;
            border-color: #808080;
        }

        .btn-flash:hover {
            background: #c5c5c5;
        }

        .btn-flash:disabled {
            opacity: 0.5;
            cursor: default;
        }

        .status-indicator {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 2px 8px;
            background: #e8e8e8;
            border: 1px solid #b0b0b0;
            border-radius: 2px;
            height: 24px;
        }

        .status-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            display: inline-block;
            border: 1px solid #808080;
        }

        .status-dot.offline {
            background: #808080;
        }

        .status-dot.online {
            background: #339933;
        }

        .status-dot.error {
            background: #cc3333;
        }

        .status-dot.flashing {
            background: #cc8800;
            animation: blink 0.5s infinite;
        }

        @keyframes blink {
            0%,
            100% { opacity: 1; }
            50% { opacity: 0.2; }
        }

        .status-text {
            font-size: 11px;
            color: #1a1a1a;
            font-weight: 500;
        }

        .main-content {
            display: flex;
            flex-direction: column;
            gap: 3px;
        }

        /* Строка устройства */
        .device-row {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 4px 8px;
            background: #e8e8e8;
            border: 1px solid #b0b0b0;
            flex-wrap: wrap;
            border-radius: 2px;
        }

        .device-row .device-label {
            font-size: 12px;
            font-weight: 600;
            min-width: 38px;
            color: #1a1a1a;
        }

        .device-row .version-display {
            font-size: 14px;
            font-weight: 600;
            color: #0066aa;
            font-family: 'Consolas', 'Courier New', monospace;
            min-width: 70px;
            text-align: center;
            background: #f8f8f8;
            padding: 0 4px;
            border: 1px solid #c0c0c0;
            border-radius: 2px;
            height: 20px;
            line-height: 20px;
        }

        .device-row select {
            background: #ffffff;
            border: 1px solid #a0a0a0;
            padding: 2px 4px;
            font-family: 'Segoe UI', Arial, sans-serif;
            font-size: 11px;
            min-width: 160px;
            height: 22px;
            flex: 1;
            min-width: 120px;
            border-radius: 2px;
        }

        .device-row select:focus {
            border-color: #0066aa;
            outline: none;
        }

        .device-row select:disabled {
            opacity: 0.5;
        }

        .device-row .btn-flash {
            min-width: 80px;
            height: 22px;
            font-size: 11px;
        }

        .device-row .status-dot-small {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            display: inline-block;
            border: 1px solid #808080;
        }

        .device-row .status-dot-small.gray {
            background: #a0a0a0;
        }

        .device-row .status-dot-small.green {
            background: #339933;
        }

        .device-row .status-dot-small.yellow {
            background: #cc8800;
        }

        .device-row .status-dot-small.red {
            background: #cc3333;
        }

        .device-row .status-dot-small.flash {
            background: #cc8800;
            animation: blink 0.5s infinite;
        }

        .device-row .status-text {
            font-size: 10px;
            min-width: 50px;
            color: #555555;
        }

        .progress-container {
            display: flex;
            align-items: center;
            gap: 6px;
            flex: 1;
            min-width: 120px;
        }

        .progress-bar {
            flex: 1;
            height: 8px;
            background: #ffffff;
            border: 1px solid #a0a0a0;
            min-width: 50px;
            border-radius: 2px;
            overflow: hidden;
        }

        .progress-bar .progress-fill {
            height: 100%;
            width: 0%;
            background: #4a8db7;
            transition: width 0.3s;
            border-radius: 2px;
        }

        .progress-text {
            font-size: 10px;
            min-width: 35px;
            text-align: right;
            font-family: 'Consolas', 'Courier New', monospace;
            color: #333333;
        }

        /* Лог */
        .log-container {
            background: #1a1a1a;
            border: 1px solid #808080;
            height: 200px;
            overflow-y: auto;
            font-family: 'Consolas', 'Courier New', monospace;
            font-size: 9px;
            padding: 3px;
            margin-top: 3px;
            border-radius: 2px;
        }

        .log-container .log-entry {
            padding: 1px 4px;
            border-bottom: 1px solid #2a2a2a;
            color: #d0d0d0;
            white-space: pre-wrap;
            word-break: break-all;
            line-height: 1.4;
        }

        .log-container .log-entry.error {
            color: #ff6666;
        }

        .log-container .log-entry.success {
            color: #66ff66;
        }

        .log-container .log-entry.info {
            color: #66bbff;
        }

        .log-container .log-entry.tx {
            color: #ffaa44;
        }

        .log-container .log-entry.rx {
            color: #44ddff;
        }

        .log-container .log-entry.rx_raw {
            color: #888888;
            font-size: 7px;
        }

        .log-container .log-entry.warning {
            color: #ffaa00;
            font-weight: bold;
        }

        .log-container .log-entry.flash {
            color: #ffaa00;
        }

        .log-container .log-entry.flash_ok {
            color: #66ff66;
            font-weight: bold;
        }

        .log-container .log-entry.version {
            color: #00ff88;
            font-weight: bold;
        }

        .log-toolbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 2px 6px;
            font-size: 10px;
            background: #e8e8e8;
            border: 1px solid #b0b0b0;
            margin-top: 2px;
            min-height: 20px;
            border-radius: 2px;
            color: #333333;
        }

        /* Адаптив */
        @media (max-width: 640px) {
            .device-row {
                flex-direction: column;
                align-items: stretch;
                gap: 4px;
            }

            .device-row .device-label {
                min-width: auto;
            }

            .window {
                width: 100%;
            }

            .log-container {
                height: 80px;
            }

            .toolbar {
                gap: 4px;
            }

            .btn {
                min-width: 50px;
                font-size: 10px;
                padding: 1px 8px;
            }
        }

        @media (max-width: 400px) {
            .device-row .version-display {
                font-size: 12px;
                min-width: 50px;
            }

            .device-row select {
                font-size: 10px;
                min-width: 80px;
            }

            .device-row .btn-flash {
                min-width: 60px;
                font-size: 10px;
            }
        }

        /* Стили для полосы прокрутки (Windows Forms style) */
        .log-container::-webkit-scrollbar {
            width: 14px;
            background: #e8e8e8;
        }

        .log-container::-webkit-scrollbar-track {
            background: #e8e8e8;
            border: 1px solid #b0b0b0;
        }

        .log-container::-webkit-scrollbar-thumb {
            background: #c0c0c0;
            border: 1px solid #808080;
        }

        .log-container::-webkit-scrollbar-thumb:hover {
            background: #b0b0b0;
        }

        .log-container::-webkit-scrollbar-button {
            background: #d8d8d8;
            border: 1px solid #a0a0a0;
            height: 16px;
        }

        .log-container::-webkit-scrollbar-button:hover {
            background: #c8c8c8;
        }