
html, body
{
    /*height: 100%;
    width: 100%;*/
    margin: 6px;
    padding: 0px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

#serialwarning {
    color: red;
}

.heading {
	font-weight: bold;
}

.panel {
    padding-right: 8px;
}

.smallpad {
	padding: 4px;
}

.my-button {
    cursor: pointer;
    padding: 4 6 4 6;
    border-radius: 6px;
    border: 1px solid #4c4c4c;
    background: #f5f5f5;
}

.my-button:hover {
    background: #eaeaea;
    border-color: #000;
}

.panelheader {
    border: 1px solid gray;
    background-color: #ddd;
    padding: 6px;
    border-bottom: none;
    border-radius: 8px 8px 0px 0px;
}

.panelheader-inputs {
    background-color: #d9d8ed;
}

.panelheader-outputs {
    background-color: #ccedd2;
}

.panelheader-help {
    background-color: #b1dcff;
}

#helpcontent {
	min-width: 300px;
	border: 1px solid gray;
	padding: 4px;
}

.channelstable {
    border-collapse: collapse;
    border: 1px solid gray;
    margin-bottom: 10px;
    min-width: 280;
}

.channelstable th, .channelstable td {
    border: 1px solid gray;    
}

.channelstable td {
    border-collapse: collapse;
    padding: 3px;
    min-width: 80px;
    height: 33px;
}

#chart-container {
    display: flex;
    align-items: flex-start;
}

#chart .uplot {
    flex-shrink: 0;
}

#chart-container .u-legend {
    margin-left: 10px;
}

.u-inline {
    display: table-row;
    margin: unset;
}

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

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: #8b8b8b;
    border-radius: 20px;
    transition: 0.05s;
}

.slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.05s;
}

/* Enabled ON */
input:checked + .slider {
    background: #00b721;
}

/* Disabled OFF */
input:disabled + .slider {
    background: #e1e1e1;
    cursor: default;
}

/* Disabled ON */
input:disabled:checked + .slider {
    background: #adace1;
}

/* Disabled knob */
input:disabled + .slider::before {
    background: #f5f5f5;
}

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


.script-editor {
    width: 600px;
    height: 450px;
    border: 1px solid gray;
    resize: both;
    overflow: auto;
    min-height: 100px;
    min-width: 200px;
    max-height: 80vh;
}

.script-editor .CodeMirror {
    height: 100%;
}

.script-editor .script-error-gutter {
    width: 16px;
}

.script-error-line {
    background: rgba(255, 0, 0, 0.12);
}

.script-editor .script-error-marker {
    width: 8px;
    height: 8px;
    margin: 4px auto 0;
    border-radius: 50%;
    background: red;
    cursor: help;
}

#scriptPosition {
    padding-top: 4px;
    font-family: monospace;
    font-size: 12px;
    padding: 3px 6px;
    color: #666;
    background: #f5f5f5;
    border: 1px solid gray;
    border-top: none;
    text-align: right;
}

.scriptFeedback {
    margin: 14px;
    white-space: pre-wrap;
    padding: 8px;
    border-radius: 6px;
}

#scriptError {
    display:none;
    color: #ad0000;    
    border: 1px solid #ff0000;
    font-family: monospace;
}

.compileError {
    background-color: #fff9f9;
}

.runtimeError {
    background-color: #fffdd0;
}

#scriptRunning {
    display:none;
    color: #009300;
    border: 1px solid #00a300;
    background-color: #f9fff9;
}

#scriptFinished {
    display:none;
    color: #767676;
    border: 1px solid gray;
}

.errorJump {
    cursor:pointer;
    text-decoration:underline;
}

.errorJump:hover {
    color: #441185;
}

.button-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.right-button {
    margin-left: auto;
}

#scriptConsole {
    height: 100px;
    resize: vertical;
    overflow-y: auto;
    padding: 6px 8px;
    box-sizing: border-box;

    background: #464646;
    color: #fff;

    font-family: monospace;
    font-size: 13px;
    white-space: pre-wrap;

    border: 1px solid #555;
    margin-bottom: 10px;
}


.channel-edit {
    width: 18px;
    height: 18px;
    cursor: pointer;
    opacity: 0.4;
}

.channel-edit:hover {
    opacity: 1;
}

#channelDialog {
    position: fixed;
    inset: 0;

    display: none;
    align-items: center;
    justify-content: center;

    background: rgba(0, 0, 0, 0.35);

    z-index: 1000;
}

#channelDialog.visible {
    display: flex;
}

.channel-dialog {
    width: 360px;
    padding: 20px;

    box-sizing: border-box;

    background: white;
    border: 1px solid #aaa;
    border-radius: 6px;

    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.channel-dialog-title {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;

    font-size: 18px;
    font-weight: bold;
}

.channel-dialog-close {
    border: none;
    background: none;

    font-size: 20px;
    cursor: pointer;

    padding: 0 4px;
}

.channel-dialog-type {
    display: flex;
    gap: 20px;

    margin-bottom: 20px;
}

.channel-dialog-type label {
    display: flex;
    align-items: center;
    gap: 5px;

    cursor: pointer;
}

.channel-dialog-settings {
    padding: 12px;

    border: 1px solid #ccc;
    border-radius: 4px;

    margin-bottom: 20px;
}

.channel-dialog-settings-title {
    margin-bottom: 12px;
    font-weight: bold;
}

.channel-dialog-field {
    display: flex;
    align-items: center;

    margin-bottom: 8px;
}

.channel-dialog-field:last-child {
    margin-bottom: 0;
}

.channel-dialog-field label {
    width: 80px;
}

.channel-dialog-field input {
    width: 100px;
    box-sizing: border-box;
}

.channel-dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.channel-dialog-buttons button {
    padding: 6px 14px;
}


.float-channel {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 6px;
}

.float-channel .range-min,
.float-channel .range-max {
    flex: 0 0 auto;
    white-space: nowrap;
}

.float-channel input[type="range"] {
    flex: 1 1 auto;
    min-width: 0;
    -webkit-appearance: none;
}

.float-channel input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: #8b8b8b;
}

.float-channel input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -5px;
    border-radius: 50%;
    background: #00b721;
    cursor: pointer;
}

.float-channel.readonly input[type="range"]::-webkit-slider-thumb {
    background: #adace1;
    cursor: default;
}

.float-channel.readonly input[type="range"]::-webkit-slider-runnable-track {
    background: #e1e1e1;
}


.color-channel-display {
    display: inline-block;
    width: 50px;
    height: 24px;
    box-sizing: border-box;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.25);
}




.script-tabs {
    display: flex;
    align-items: stretch;
    border-right: 1px solid #aaa;
}

.script-files-button {
    margin-left: auto;
    border: none;
    cursor: pointer;    
}
.script-files-button:hover {
	color: blue;
}

.script-tab {
    border: 1px solid #aaa;
    border-bottom: none;
    background: #ddd;
    padding: 6px 14px;
    cursor: pointer;
}

.script-tab.active {
    background: white;
    position: relative;
    top: 1px;
}

.script-tab-add {
    border: none;
    background: transparent;
    font-size: 18px;
    padding: 0 12px;
    cursor: pointer;
}

.script-editor {
    display: none;
}

.script-editor.active {
    display: block;
}

.script-tab-close {
	padding-left: 8px;
	font-weight: bold;
}

.script-tab-name:hover {
	color: blue;
}

.script-tab-close:hover {
	color: red;
}




.script-file-dialog {
    display: none;
}

.script-file-dialog.visible {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.script-file-dialog-content {
    background: white;
    padding: 20px;
    min-width: 350px;
    max-width: 80vw;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid #888;
    border-radius: 4px;
}

.script-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.script-file-row span {
    flex: 1;
}

.script-file-buttons {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}



.scriptapitable {
	border-collapse: collapse;
	border: 1px solid gray;
	margin: 4px;
}

.funcname {
	color: #000097;
}

.funcparams {
	color: #004800;
}

.scriptapitable td,th {
	padding: 4px;
}

.scriptapitable th {
	background-color: #dfdfdf;
	border: 1px solid gray;
}

.scriptapitable td {
	border: 1px solid gray;
}

.smaller {
	font-size: 0.9em;
}

.scriptapitable pre {
	color: #660a00;
	margin: 1em;
}

.scripthelptableheader {
	font-weight: bold;
	margin: 16px 0px 2px 0px;
}

.scriptapisectiontoggle {
	font-weight: normal;
	font-size: 0.9em;
	color: purple;
	cursor: pointer;
	border: 1px solid #cfcfcf;
	padding: 2px;
	border-radius: 6px;
}

.scriptapisectiontoggle:hover {
	background-color: #ededff;
}




.pps {
	font-size: 0.9em;
}

.ppsInactive {
	color: gray;
}

.ppActive {
	color: green;
	font-weight: bold;
}

.codefont {
    font-family: monospace;
    font-size: 1em;
    background-color: #ebebeb;
    vertical-align: text-bottom;
    padding: 3px;
}
















