* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    padding: 10px;
}

.app {
    max-width: 650px;
    margin: auto;
}

.page-header {
    background: #020617;
    padding: 20px;
    border-bottom: 1px solid #1e293b;
    border-radius: 12px 12px 0 0;
}

.subtitle {
    color: #94a3b8;
    font-size: 13px;
    margin: 5px 0 0;
}

.summary {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    flex-wrap: wrap;
    gap: 10px;
}

.summary-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.net-info {
    color: #64748b;
    border-left: 1px solid #1e293b;
    padding-left: 12px;
}

.tabs {
    display: flex;
    background: #020617;
    border-bottom: 1px solid #1e293b;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 14px;
    cursor: pointer;
    color: #64748b;
    font-weight: 600;
    transition: 0.3s;
}

.tab.active {
    color: #38bdf8;
    border-bottom: 3px solid #38bdf8;
    background: rgba(56, 189, 248, 0.05);
}

.content {
    display: none;
    padding: 20px 0;
}

.content.active {
    display: block;
}

.card {
    background: #020617;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.channel-box {
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    background: #0f172a;
}

.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 10px;
}

.channel-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.channel-value {
    font-size: 32px;
    color: #38bdf8;
    font-family: monospace;
    font-weight: bold;
}

.led-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
}

.led {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1e293b;
    border: 3px solid #334155;
    transition: 0.3s;
}

.led.active {
    background: #38bdf8;
    border-color: #7dd3fc;
    box-shadow: 0 0 15px #38bdf8;
}

.channel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #1e293b;
}

.sw-label {
    font-weight: bold;
    letter-spacing: 0.5px;
    color: #64748b;
}

.sw-label.active {
    color: #38bdf8;
}

.st-ok {
    color: #22c55e;
}

.st-warn {
    color: #facc15;
}

.st-off {
    color: #94a3b8;
}

.wifi-on {
    color: #22c55e;
    font-weight: bold;
}

.wifi-off {
    color: #ef4444;
    font-weight: bold;
}

.config-table {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.config-header {
    display: grid;
    grid-template-columns: 60px 1fr 1fr 1fr;
    gap: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #334155;
}

.config-header span {
    font-size: 10px;
    font-weight: bold;
    color: #94a3b8;
    text-align: center;
}

.config-row {
    display: grid;
    grid-template-columns: 60px 1fr 1fr 1fr;
    gap: 10px;
    align-items: center;
}

.config-header.compact,
.config-row.compact {
    grid-template-columns: 60px 1fr 1fr;
}

.config-row label {
    font-weight: bold;
    font-size: 13px;
    color: #cbd5e1;
}

.span-3 {
    grid-column: span 3;
}

input,
select,
button {
    width: 100%;
}

input,
select {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
    color: white;
    font-size: 14px;
    outline: none;
}

input:disabled {
    color: #94a3b8;
    background: #111827;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1em;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

button {
    padding: 14px;
    background: #38bdf8;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    color: #020617;
    transition: 0.2s;
}

button:hover {
    background: #7dd3fc;
}

.toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.toggle {
    position: relative;
    width: 50px;
    height: 26px;
    display: inline-block;
}

.toggle input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    background: #334155;
    border-radius: 34px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: 0.4s;
}

.slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider {
    background: #22c55e;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.field-label {
    display: block;
    margin-bottom: 6px;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.spacer {
    height: 18px;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #020617;
    color: #e2e8f0;
    padding: 12px 18px;
    border: 1px solid #334155;
    border-radius: 10px;
    display: none;
    z-index: 20;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.activity-item {
    border: 1px solid #1e293b;
    border-radius: 10px;
    background: #0f172a;
    padding: 12px;
}

.activity-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 6px;
}

.activity-msg {
    font-size: 13px;
    color: #e2e8f0;
    word-break: break-word;
}

.empty-state {
    color: #64748b;
    font-size: 13px;
    text-align: center;
    padding: 12px 0;
}

@media (max-width: 640px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .channel-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}
