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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #c0c0c0 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #c0c0c0 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 0.2s, opacity 0.6s ease, filter 0.6s ease, transform 0.1s ease;
    width: 100%;
    opacity: 1;
    filter: brightness(1);
}

button span {
    display: inline-block;
}

button:active:not(:disabled) {
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    transform: translate(2px, 2px);
}

button.button-disabled {
    opacity: 0.5;
    filter: brightness(0.7);
}

button:disabled {
    cursor: not-allowed;
}

button:hover:not(:disabled) {
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    width: 600px;
}

.container.wide {
    width: fit-content;
    transition: width 0.3s ease;
}

h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
}

label {
    display: block;
    color: #555;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.matrix-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.matrix-actions button {
    flex: 1;
    width: auto;
}

.matrix-checkbox,
.filter-checkbox {
    width: 40px;
    height: 40px;
    appearance: none;
    border: 2px solid #d0d0d0;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    background: white;
}

.matrix-checkbox:checked,
.filter-checkbox:checked {
    background: linear-gradient(135deg, #667eea 0%, #c0c0c0 100%);
    border-color: #667eea;
}

.matrix-checkbox:hover,
.filter-checkbox:hover {
    border-color: #667eea;
}

.matrix-grid {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.matrix-label {
    width: 60px;
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.matrix-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

#nextButton {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

#nextButton:active:not(:disabled) {
    box-shadow: 0 4px 10px rgba(72, 187, 120, 0.3);
}

#nextButton:hover:not(:disabled) {
    box-shadow: 0 8px 20px rgba(72, 187, 120, 0.4);
}

#sendBtn,
.send-button {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

#sendBtn:active:not(:disabled),
.send-button:active:not(:disabled) {
    box-shadow: 0 4px 10px rgba(72, 187, 120, 0.3);
}

#sendBtn:hover:not(:disabled),
.send-button:hover:not(:disabled) {
    box-shadow: 0 8px 20px rgba(72, 187, 120, 0.4);
}

.filters-column-header {
    background: #f0f0f0;
    border-radius: 4px;
    padding: 4px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.filters-grid {
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 8px 24px;
    align-items: center;
    width: fit-content;
    margin: 0 auto;
}

.filters-title,
.filters-span {
    grid-column: 2 / 4;
}

.filters-actions {
    margin-top: 12px;
}

.filter-label {
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.filter-switches {
    display: flex;
    gap: 8px;
}

.output-label {
    width: 40px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

.output-labels {
    display: flex;
    gap: 8px;
    margin-left: 68px;
    margin-bottom: 8px;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

.patch-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.patch-item:hover {
    background: #f0f0f0;
}

.patch-item.selected {
    background: #667eea;
    color: white;
}

.patch-list {
    width: 200px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto;
}

.patches-container {
    display: flex;
    gap: 20px;
    height: 500px;
}

.routing-matrix {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
}

.routing-matrix .matrix-actions {
    align-self: stretch;
}

.patch-change {
    margin-bottom: 25px;
}

.patch-change-controls {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    margin-top: 12px;
}

.patch-change-controls select {
    width: 140px;
}

.patch-change-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    cursor: pointer;
}

.section {
    margin-bottom: 25px;
}

.section-title {
    background: linear-gradient(135deg, #667eea 0%, #c0c0c0 100%);
    border-radius: 4px;
    padding: 6px 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: white;
}

select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

select:focus {
    outline: none;
    border-color: #667eea;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brightness-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
}

.brightness-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #c0c0c0 100%);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.brightness-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #c0c0c0 100%);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slider-value {
    min-width: 32px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #555;
}

.status {
    margin-top: 25px;
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
}

.status.error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #c62828;
}

.status.info {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #1565c0;
}

.status.success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #2e7d32;
}

.status.warning {
    background: #fff3e0;
    color: #e65100;
    border-left: 4px solid #e65100;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.tab {
    padding: 12px 24px;
    background: #f5f5f5;
    border: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    transition: background 0.2s, color 0.2s;
}

.tab.active {
    background: linear-gradient(135deg, #667eea 0%, #c0c0c0 100%);
    color: white;
}

.tab:disabled {
    opacity: 0.5;
}

.tab:hover:not(.active):not(:disabled) {
    background: #e8e8e8;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-pane-wrapper {
    border: 2px solid #e0e0e0;
    border-top: none;
    border-radius: 8px;
    padding: 20px;
}

.tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 0;
    gap: 5px;
}
