﻿@media (hover: hover) {
    .widget-delete-button:hover {
        background-color: rgba(227, 41, 64, 0.25);
        box-shadow: 0 0 10px rgba(227, 41, 64, 0.3);
        transform: scale(1.1);
    }
}

@media (hover: none) {
    .widget-delete-button:active {
        background-color: rgba(227, 41, 64, 0.25);
        box-shadow: 0 0 10px rgba(227, 41, 64, 0.3);
        transform: scale(1.1);
    }
}

.widget-delete-button {
    position: absolute;
    top: var(--widget-action-offset, 0.75rem);
    right: var(--widget-action-offset, 0.75rem);
    width: var(--widget-action-size, 3rem);
    height: var(--widget-action-size, 3rem);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 25%;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    z-index: 10;
}

.widget-delete-button img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    pointer-events: none; /* so the click hits the div, not the image */
}

.widget-clipboard-button {
    position: absolute;
    top: var(--widget-action-offset, 0.75rem);
    right: var(--widget-clipboard-right, calc(var(--widget-action-offset, 0.75rem) + var(--widget-action-size, 3rem) + var(--widget-action-gap, 0.75rem)));
    width: var(--widget-action-size, 3rem);
    height: var(--widget-action-size, 3rem);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 25%;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    z-index: 10;
}

.widget-edit-button {
    position: absolute;
    top: var(--widget-action-offset, 0.75rem);
    right: var(--widget-edit-right, calc(var(--widget-action-offset, 0.75rem) + var(--widget-action-size, 3rem) * 2 + var(--widget-action-gap, 0.75rem) * 2));
    width: var(--widget-action-size, 3rem);
    height: var(--widget-action-size, 3rem);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 25%;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    z-index: 10;
}

.widget-edit-button img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    pointer-events: none;
}

.widget-clipboard-button img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    pointer-events: none;
}

@media (hover: hover) {
    .widget-edit-button:hover {
        background-color: rgba(12, 240, 114, 0.25);
        box-shadow: 0 0 10px rgba(12, 240, 114, 0.3);
        transform: scale(1.1);
    }
}

@media (hover: none) {
    .widget-edit-button:active {
        background-color: rgba(12, 240, 114, 0.25);
        box-shadow: 0 0 10px rgba(12, 240, 114, 0.3);
        transform: scale(1.1);
    }
}

@media (hover: hover) {
    .widget-clipboard-button:hover {
        background-color: rgba(255, 217, 0, 0.25);
        box-shadow: 0 0 10px rgba(255, 217, 0, 0.3);
        transform: scale(1.1);
    }
}

@media (hover: none) {
    .widget-clipboard-button:active {
        background-color: rgba(255, 217, 0, 0.25);
        box-shadow: 0 0 10px rgba(255, 217, 0, 0.3);
        transform: scale(1.1);
    }
}

.drag-enabled {
    cursor: grabbing !important;
    box-shadow: 0 0 0 3px rgba(0, 229, 226, 0.45), 0 0 15px rgba(0, 229, 226, 0.35);
    border: 2px dashed rgba(0, 229, 226, 0.8);
    opacity: 0.9;
    transform: scale(1.05);
}

.resize-enabled,
.resize-enabled > .widget-instance {
    box-shadow: 0 0 0 3px rgba(0, 229, 226, 0.45), 0 0 15px rgba(0, 229, 226, 0.35);
    border: 2px dashed rgba(0, 229, 226, 0.8);
    opacity: 0.9;
}

.widget-wrapper.overlap {
    z-index: 20;
}

.widget-wrapper.overlap .widget-instance {
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

.widget-customize-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.85);
    /* Performance: backdrop-filter removed - causes stutter when opening */
    display: flex;
    align-items: center;
    justify-content: center;
    /*    z-index: 1000;*/
    z-index: 1300;
}

.alarm-edit-overlay {
    align-items: flex-start;
    justify-content: center;
    padding-top: 5vh;
    padding-bottom: calc(var(--footer-height) + var(--footer-gap));
}

.widget-customize-panel {
    position: absolute;
    width: 95vw;
    max-width: 1200px;
    max-height: 80vh !important;
    padding: 1rem;
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    user-select: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    --widget-field-font-size: 0.95rem;
    --widget-field-padding-y: 0.55rem;
    --widget-field-padding-x: 0.75rem;
    --widget-field-border-radius: 0.4rem;
    --widget-field-bg: rgba(255, 255, 255, 0.06);
    --widget-field-bg-hover: rgba(255, 255, 255, 0.12);
    --widget-field-bg-focus: rgba(0, 229, 226, 0.15);
    --widget-field-border-color: rgba(255, 255, 255, 0.2);
    --widget-field-border-color-hover: rgba(0, 229, 226, 0.45);
    --widget-field-border-color-focus: #00E5E2;
    --widget-field-shadow-focus: 0 0 0 2px rgba(0, 229, 226, 0.35);
    --widget-field-text-color: #ffffff;
    --widget-field-placeholder-color: rgba(255, 255, 255, 0.6);
    --widget-field-disabled-bg: rgba(255, 255, 255, 0.08);
    --widget-field-disabled-border-color: rgba(255, 255, 255, 0.12);
    --widget-field-disabled-text: rgba(255, 255, 255, 0.5);
    --widget-field-transition: 0.18s ease;
    --widget-select-arrow: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3e%3cpath fill='%23ffffff' d='M1 1l5 5 5-5'/%3e%3c/svg%3e");
}

.widget-customize-panel.user-manager-panel {
    height: calc(var(--app-height) - var(--footer-height) - var(--footer-gap));
}

@supports (height: 100dvh) {
    .widget-customize-panel.user-manager-panel {
        height: calc(100dvh - var(--footer-height) - var(--footer-gap));
    }
}

/* panels now render immediately without waiting for JS toggles */

@supports (height: 100dvh) {
    .widget-customize-panel {
        max-height: calc(100dvh - var(--footer-height) - var(--footer-gap));
    }
}

.alarm-customize-panel {
    min-width: 450px;
}

.widget-customize-panel.user-manager-compact-panel {
    width: min(90vw, 36rem);
    max-width: 36rem;
}

/* keep dialogs visible above the footer */

.alarm-edit-overlay .widget-customize-panel,
.alarm-history-overlay .widget-customize-panel {
/*    width: min(95vw, calc(100vw - 2rem));*/
/*    max-width: 95vw;*/
/*    max-height: calc(var(--app-height) - var(--footer-height) - var(--footer-gap));*/
    overflow-y: auto;
    overflow-x: hidden;
}

@supports (height: 100dvh) {
    .alarm-edit-overlay .widget-customize-panel,
    .alarm-history-overlay .widget-customize-panel {
        max-height: calc(100dvh - var(--footer-height) - var(--footer-gap));
    }
}

/* keep calibration dialog visible above the footer */

.calibration-edit-overlay .calibration-panel {
    height: calc(var(--app-height) - var(--footer-height) - var(--footer-gap));
    max-height: calc(var(--app-height) - var(--footer-height) - var(--footer-gap));
    width: 95vw;
    max-width: 1200px;
    overflow-y: auto;
}

@supports (height: 100dvh) {
    .calibration-edit-overlay .calibration-panel {
        height: calc(100dvh - var(--footer-height) - var(--footer-gap));
        max-height: calc(100dvh - var(--footer-height) - var(--footer-gap));
    }
}

.widget-customize-panel h3 {
    margin: 0;
    color: #00E5E2;
}

.widget-customize-panel label {
    font-weight: 600;
    font-size: 0.9rem;
    width: 100%;
}

.widget-customize-panel .form-control {
    color: var(--widget-field-text-color);
}

.widget-customize-panel .form-control::placeholder {
    color: var(--widget-field-placeholder-color);
    opacity: 1;
}
.widget-field-control,
.widget-customize-panel :is(input[type="text"],
        input[type="number"],
        input[type="search"],
        input[type="email"],
        input[type="password"],
        input[type="url"],
        input[type="tel"],
        input[type="time"],
        input[type="date"],
        input[type="datetime-local"],
        textarea,
        select) {
    width: 100%;
    background: var(--widget-field-bg);
    color: var(--widget-field-text-color);
    border: 1px solid var(--widget-field-border-color);
    border-radius: var(--widget-field-border-radius);
    padding: var(--widget-field-padding-y) var(--widget-field-padding-x);
/*    font-size: var(--widget-field-font-size);*/
    font-size: 0.95rem;
    line-height: 1.4;
    transition: background-color var(--widget-field-transition),
    border-color var(--widget-field-transition),
    box-shadow var(--widget-field-transition),
    color var(--widget-field-transition);
}

.widget-customize-panel :is(input[type="text"],
        input[type="number"],
        input[type="search"],
        input[type="email"],
        input[type="password"],
        input[type="url"],
        input[type="tel"],
        input[type="time"],
        input[type="date"],
        input[type="datetime-local"],
        textarea,
        select):hover,
.widget-field-control:hover {
    background: var(--widget-field-bg-hover);
    border-color: var(--widget-field-border-color-hover);
}

.widget-customize-panel :is(input[type="text"],
        input[type="number"],
        input[type="search"],
        input[type="email"],
        input[type="password"],
        input[type="url"],
        input[type="tel"],
        input[type="time"],
        input[type="date"],
        input[type="datetime-local"],
        textarea,
        select):focus,
.widget-customize-panel :is(input[type="text"],
        input[type="number"],
        input[type="search"],
        input[type="email"],
        input[type="password"],
        input[type="url"],
        input[type="tel"],
        input[type="time"],
        input[type="date"],
        input[type="datetime-local"],
        textarea,
        select):focus-visible,
.widget-field-control:focus,
.widget-field-control:focus-visible {
    outline: none;
    background: var(--widget-field-bg-focus);
    border-color: var(--widget-field-border-color-focus);
    box-shadow: var(--widget-field-shadow-focus);
}

.widget-customize-panel :is(input[type="text"],
        input[type="number"],
        input[type="search"],
        input[type="email"],
        input[type="password"],
        input[type="url"],
        input[type="tel"],
        input[type="time"],
        input[type="date"],
        input[type="datetime-local"],
        textarea,
        select):disabled,
.widget-field-control:disabled {
    background: var(--widget-field-disabled-bg);
    border-color: var(--widget-field-disabled-border-color);
    color: var(--widget-field-disabled-text);
    cursor: not-allowed;
}

.widget-customize-panel :is(input[type="text"],
        input[type="number"],
        input[type="search"],
        input[type="email"],
        input[type="password"],
        input[type="url"],
        input[type="tel"],
        input[type="time"],
        input[type="date"],
        input[type="datetime-local"],
        textarea,
        select)::placeholder,
.widget-field-control::placeholder {
    color: var(--widget-field-placeholder-color);
    opacity: 1;
}

.widget-customize-panel input[type="color"] {
    width: 100%;
    background: none;
    color: inherit;
    border: 1px solid var(--widget-field-border-color);
    padding: 0;
    border-radius: var(--widget-field-border-radius);
    margin-bottom: 0.5rem;
    height: 2rem;
}

.widget-customize-panel label.color-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.widget-customize-panel label.color-picker input[type="color"] {
    width: 2.5rem;
    height: 1.5rem;
    padding: 0;
    background: none;
    border: 1px solid var(--widget-field-border-color);
    border-radius: var(--widget-field-border-radius);
}

.widget-customize-panel select,
.widget-field-control select {
    appearance: none;
    background-image: var(--widget-select-arrow);
    background-repeat: no-repeat;
    background-position: calc(100% - var(--widget-field-padding-x)) 50%;
    background-size: 0.75rem auto;
    padding-right: calc(var(--widget-field-padding-x) * 2 + 0.75rem);
    cursor: pointer;
}

.widget-customize-panel select option,
.widget-field-control select option {
    background-color: #101214;
    color: var(--widget-field-text-color);
}

.widget-customize-panel select option:checked,
.widget-customize-panel select option:hover,
.widget-customize-panel select option:focus,
.widget-field-control select option:checked,
.widget-field-control select option:hover,
.widget-field-control select option:focus {
    background-color: #00E5E2;
    color: #041014;
}

.widget-customize-panel select:disabled,
.widget-field-control select:disabled {
    background-image: none;
}

.widget-customize-panel .custom-select {
    position: relative;
    display: flex;
    align-items: center;
    min-height: calc(1.4rem + 2 * var(--widget-field-padding-y));
    background: var(--widget-field-bg);
    color: var(--widget-field-text-color);
    border: 1px solid var(--widget-field-border-color);
    border-radius: var(--widget-field-border-radius);
    padding: calc(var(--widget-field-padding-y) - 0.05rem) var(--widget-field-padding-x);
    cursor: pointer;
    user-select: none;
    transition: background-color var(--widget-field-transition),
    border-color var(--widget-field-transition),
    box-shadow var(--widget-field-transition);
}

.widget-customize-panel .custom-select:hover {
    background: var(--widget-field-bg-hover);
    border-color: var(--widget-field-border-color-hover);
}

.widget-customize-panel .custom-select[aria-expanded="true"],
.widget-customize-panel .custom-select:focus,
.widget-customize-panel .custom-select:focus-within {
    outline: none;
    background: var(--widget-field-bg-focus);
    border-color: var(--widget-field-border-color-focus);
    box-shadow: var(--widget-field-shadow-focus);
}

.widget-customize-panel .selected-value {
    position: relative;
    flex: 1;
    padding-right: calc(var(--widget-field-padding-x) + 0.75rem);
}

.widget-customize-panel .selected-value::after {
    content: "";
    position: absolute;
    inset-inline-end: 0;
    inset-block-start: 50%;
    translate: 0 -50%;
    width: 0.75rem;
    height: 0.45rem;
    background-image: var(--widget-select-arrow);
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

.widget-customize-panel .custom-options {
    position: absolute;
    inset-inline: -1px;
    top: calc(100% + 0.25rem);
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid var(--widget-field-border-color);
    border-radius: 0 0 var(--widget-field-border-radius) var(--widget-field-border-radius);
    overflow: hidden;
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.4);
    z-index: 20;
}

.widget-customize-panel .custom-select.is-open .selected-value::after {
    rotate: 180deg;
}

.widget-customize-panel .custom-option {
    padding: 0.5rem var(--widget-field-padding-x);
    transition: background-color var(--widget-field-transition),
    color var(--widget-field-transition);
}

.widget-customize-panel .custom-option:hover,
.widget-customize-panel .custom-option.active {
    background: var(--widget-field-bg-hover);
}

.widget-customize-panel .custom-option.selected {
    background: rgba(0, 229, 226, 0.3);
    color: black;
    font-weight: 600;
}

.widget-customize-panel .custom-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.widget-customize-panel .customize-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    padding-inline: 0.5rem 1rem;
    scrollbar-gutter: stable both-edges;
}

.widget-customize-panel > .customize-content.user-manager-content-panel {
    overflow: hidden;
    overflow-y: hidden;
    scrollbar-gutter: auto;
    padding-inline: 1rem;
}

.widget-customize-panel.two-column > .customize-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}

.widget-customize-panel.two-column > .customize-content > .custom-column {
    min-width: 0;
}

.widget-customize-panel.two-column .customize-content .col-span-2 {
    grid-column: span 2;
}

.widget-customize-panel.two-column .customize-content .watermaker-routing {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.widget-customize-panel.two-column .customize-content .watermaker-routing__column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.output-select-panel {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem 1.5rem;
}

.output-select-panel > * {
    min-width: 0;
}

.widget-customize-panel .widget-field {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.widget-customize-panel .clear-selection {
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.1rem 0;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--widget-field-transition),
        opacity var(--widget-field-transition);
}

.widget-customize-panel .clear-selection:hover:not(:disabled),
.widget-customize-panel .clear-selection:focus-visible:not(:disabled) {
    color: #00E5E2;
}

.widget-customize-panel .clear-selection:disabled {
    color: rgba(255, 255, 255, 0.35);
    cursor: default;
    opacity: 0.6;
}

.output-source-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.close-customize-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    line-height: 1;
    margin-left: auto;
    padding: 0;
    transition: color 0.2s ease-in-out;
}

.close-customize-button:hover {
    color: #00E5E2;
}

.close-customize-button.cancel {
    font-size: 2rem;
}

.customize-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.customize-footer .btn-danger {
    width: 30%;
}

.widget-dialog-save {
    align-self: center;
    margin-top: auto;
    margin-inline: auto;
/*    width: min(26rem, 100%);*/
    width: 30%;
}

.widget-customize-panel .custom-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
}

.form-field .field-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    color: inherit;
}

.form-field .field-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-field :is(.widget-field-control,
        input[type="text"],
        input[type="number"],
        input[type="search"],
        input[type="email"],
        input[type="password"],
        input[type="url"],
        input[type="tel"],
        input[type="time"],
        input[type="date"],
        input[type="datetime-local"],
        textarea,
        select) {
    margin-bottom: 0;
}

.inline-number-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.inline-number-field .number-input {
    width: 100%;
    font-size: 0.95rem;
}

.tank-column h4 {
    margin: 0;
    color: #00E5E2;
}

/*.inline-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.inline-inputs.three {
    grid-template-columns: minmax(48ch, 2fr) minmax(18ch, 1fr) max-content;
    align-items: end;
}*/

.inline-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.inline-inputs > div {
    width: 100%;
}

.inline-number-field input {
    width: 100% !important;
}

/*.inline-inputs.three.pid-inputs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inline-inputs.three.pid-inputs > div {
    min-width: 0;
}

.inline-inputs.three > div:first-child input {
    width: 100%;
    min-width: 48ch;
}

.inline-inputs.three.pid-inputs > div:first-child input {
    min-width: 0;
}

.inline-inputs.three > div:last-child input {
    width: 5ch;
}

.inline-inputs.three.pid-inputs > div:last-child input {
    width: 100%;
}

.inline-inputs.three.pid-inputs > div input {
    width: 100%;
    min-width: 0;
}*/

/*.inline-inputs > div {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}*/

.number-with-unit {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.light-checkbox-list {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.3rem;
    padding: 0.5rem;
    max-height: 10rem;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.light-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.light-checkbox input {
    accent-color: #00E5E2;
}

.sensor-radio-list {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.3rem;
    padding: 0.5rem;
    max-height: 10rem;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.sensor-radio-list.small {
    max-height: 8rem;
}

.sensor-radio {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.sensor-radio span {
    flex: 1;
    white-space: nowrap;
    overflow: visible;
    text-overflow: ellipsis;
}

.sensor-radio input {
    accent-color: #00E5E2;
}

.light-checkbox input:checked + span,
.sensor-radio input:checked + span {
    color: #00E5E2;
    font-weight: 600;
}

.alarm-link-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.alarm-link-list .btn {
    width: 100%;
    justify-content: flex-start;
}

.alarm-buttons {
    display: flex;
    gap: 0.5rem;
}

.alarm-buttons button:last-child {
    margin-left: auto;
}

.set-alarm {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.25rem;
    color: white;
    font-size: 0.95rem;
    text-transform: uppercase;
    transition: all 0.2s ease-in-out;
}

.set-alarm:hover {
    background-color: rgba(0, 229, 226, 0.4);
    border-color: rgba(0, 229, 226, 0.6);
    color: #e4ffff;
}

.alarm-table {
    width: 100%;
    margin: 0.5rem 0;
    border-collapse: collapse;
}

.alarm-table td {
    padding: 0.25rem;
}

.alarm-name {
    width: 100%;
}

.alarm-actions {
    text-align: right;
}

.alarm-add-item td {
    vertical-align: top;
}

.alarm-add-buttons {
    display: flex;
    gap: 0.5rem;
}

.alarm-section-title {
    margin-top: 0.5rem;
    font-weight: bold;
}

.remove-alarm {
    height: 2rem;
    width: 2rem;
    padding: 0.1rem 0.4rem;
    background: rgba(227, 41, 64, 0.2);
    border: 1px solid rgba(227, 41, 64, 0.4);
    border-radius: 0.3rem;
    color: white;
    transition: all 0.2s ease-in-out;
}

.remove-alarm:hover {
    background-color: rgba(227, 41, 64, 0.4);
    border-color: rgba(227, 41, 64, 0.6);
    color: #ffeaed;
}

.close-calibration {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    margin-top: 0;
    padding: 0.25rem 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid currentColor;
    border-radius: 0.3rem;
    color: inherit;
    font-size: 2vh;
}

.calibration-panel {
    
}

.calibration-row-container {
    width: 100%;
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 2rem;
}

.calibration-row {
    width: 100%;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 0.5rem;
}

.calibration-row label {
    font-size: 0.95rem;
}

.calibration-row .number-input {
    width: 100% !important;
    font-size: 0.95rem !important;
    margin-bottom: 0 !important;
}

.calibration-row input[type=text] {
    width: 100%;
    min-height: 30px;
    color: white;
    font-size: 0.95rem;
}

.calibration-row .alarm-buttons {
    width: 100%;
}

.calibration-row .output-select-panel {
    width: 100%;
}

.output-select-panel input[type="text"],
.output-select-panel .selected-value {
    color: white;
}

.output-select-panel input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.calibration-row .custom-select {
    width: 100%;
}

.unit-select {
    width: 100%;
}

.calibrated-group {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.calibrated-group label {
    min-width: 12%;
}

.minmax-calib {
    width: 100%;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid currentColor;
    border-radius: 0.25rem;
    color: inherit;
    font-size: 0.95rem;
    text-transform: uppercase;
    transition: all 0.2s ease-in-out;
}

.minmax-calib:hover {
    background-color: rgba(0, 229, 226, 0.4);
    border-color: rgba(0, 229, 226, 0.6);
    color: #E4FFFF;
}

.minmax-calib.disabled {
    background: none;
    border: 1px solid #7F8C8D;
    color: #7F8C8D;
}

.minmax-calib.disabled:hover {
    cursor: not-allowed;
}

.widget-disabled-overlay {
    position: absolute !important;
    inset: 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.9) !important;
    border-radius: 0.5rem !important;
    font-size: 0.95rem !important;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: start !important;
    justify-content: start;
    z-index: 5;
    pointer-events: all;
    overflow-x: hidden;
    overflow-y: auto;
}

.widget-wrapper.editable .widget-instance > .widget-disabled-overlay {
        top: calc(
        var(--widget-action-offset, 0.75rem)
        + var(--widget-action-size, 3rem)
        + var(--widget-action-gap, 0.75rem) * 0.5
    );

    /*    border-top-left-radius: 0;*/
    /*    border-top-right-radius: 0;*/
}

.interaction-blocker {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: all;
}

.widget-wrapper.editable .interaction-blocker {
    top: calc(
        var(--widget-action-offset, 0.75rem)
        + var(--widget-action-size, 3rem)
        + var(--widget-action-gap, 0.75rem) * 0.5
    );

    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/*.widget-disabled-overlay strong {
    display: flex;
    padding-left: 2%;
}*/

.widget-disabled-overlay ul {
    display: flex;
    flex-direction: column !important;
    align-items: start !important;
    gap: 0.5rem !important;
}

.toggle-options {
    margin-top: 1.2rem;
}

.template-panel .widget-template.fuse-board .template-content{
    overflow:auto;
}

/* widen and shorten module debug popup to avoid scrollbars and footer overlap */

.module-debug-overlay .widget-customize-panel {
    min-width: 450px;
}

@supports (height: 100dvh) {
    .module-debug-overlay .widget-customize-panel {
        max-height: calc(90dvh - var(--footer-height) - var(--footer-gap));
    }
}

    .module-debug-overlay .widget-customize-panel.user-manager-panel {
        align-self: center;
        height: 100%;
        margin-top: var(--footer-gap);
        margin-bottom: calc(var(--footer-gap) + calc(var(--app-base-unit) * 0.75));
    }

.vent-chart {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.3rem;
    touch-action: none; /* allow smooth dragging on touch devices */
    -ms-touch-action: none;
}

.vent-chart svg {
    width: 100%;
    height: 100%;
}

.vent-chart .control-point {
    fill: #ff8080;
    stroke: white;
    stroke-width: 0.5;
    cursor: pointer;
    touch-action: none; /* keep pointer captured while dragging */
    -ms-touch-action: none;
}

.vent-chart .control-hitbox {
    fill: transparent;
    stroke: none;
    cursor: pointer;
    touch-action: none;
    -ms-touch-action: none;
}

.vent-chart .fan-line {
    stroke: #00E5E2;
    stroke-width: 1;
    fill: none;
}

.vent-chart .c-fan-line {
    stroke: var(--mud-palette-primary);
    stroke-width: 1;
    fill: none;
}

.vent-chart .projection {
    stroke: gray;
    stroke-dasharray: 2 2;
    pointer-events: none;
}

.vent-chart .hyst-line {
    stroke: #00E5E2; /* match fan line color */
    stroke-dasharray: 1 2;
    pointer-events: none;
}

.vent-chart .c-hyst-line {
    stroke: var(--mud-palette-primary); /* match fan line color */
    stroke-dasharray: 1 2;
    pointer-events: none;
}

.vent-chart .current-point {
    fill: #ffff80;
    stroke: white;
    stroke-width: 0.5rem;
    pointer-events: none;
}

.vent-chart .current-point.low {
    fill: gray;
}

.current-temp {
    margin-top: 0.4rem;
    text-align: center;
    color: white;
}

.output-value {
    margin-top: 0.4rem;
    text-align: center;
    color: white;
}

.set-alarm-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alarm-list {
    list-style: none;
    padding-left: 0;
}

.alarm-list li {
    margin-bottom: 5px;
}

.panel-title {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.panel-title h3 {
    margin: 0;
    flex: 1;
    text-transform: uppercase;
}

/* Profile */

.profile-name-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(20, 20, 20, 1) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/*.profile-name-input:focus {
    border-color: rgba(0, 123, 255, 0.75) !important;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.35);
}*/





/* === MEDIA === */

/* Mobile  */

@media (max-width: 699px) {
    .module-debug-overlay .widget-customize-panel {
        min-width: unset;
    }

    .customize-content p {
        margin: 0;
    }

    .module-key {
        font-size: 0.75rem;
    }

    .calibrated-group {
        flex-direction: column;
        align-items: start;
        gap: 0.5rem;
    }

    .widget-customize-panel.two-column > .customize-content {
        display: flex;
        flex-direction: column;
    }

    .selected-signal-row .selected-signal-name {
        max-width: 40vw;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .selected-signal.output {
        padding: 0.25rem 0.5rem;
    }

    .inline-inputs {
        flex-wrap: wrap;
    }

    .widget-customize-panel {
        padding: 0.5rem;
    }
}

/* WVGA / WVGA-Narrow (720x480, 800x480) */

@media (min-width: 700px) and (max-width: 880px) {
    .customize-content p {
        margin: 0;
    }

    .module-key {
        font-size: 0.85rem;
    }
}

/* WSVGA / XGA (1024x600, 1024x768) */

@media (min-width: 881px) and (max-width: 1150px) {
    .customize-content p {
        margin: 0;
    }

    .module-key {
        font-size: 0.85rem;
    }
}

/* WXGA / HD720 / SXGA (1280x720/800/1024) */

@media (min-width: 1151px) and (max-width: 1600px) {

    .panel-title h3 {
        font-size: 1.5rem;
    }

    .close-customize-button.cancel {
        font-size: 1.5rem;
    }

    .customize-content {
        font-size: 0.85rem;
    }

    .customize-content p {
        margin: 0;
    }

    .calibration-row label {
        font-size: 0.85rem;
    }

    .calibration-row input[type=text] {
        font-size: 0.85rem;
    }

    .calibration-row .number-input {
        font-size: 0.85rem !important;
    }

    .minmax-calib {
        font-size: 0.85rem;
    }

    .set-alarm {
        font-size: 0.85rem;
    }

    .widget-field-control, 
    .widget-customize-panel :is(input[type="text"], 
    input[type="number"], 
    input[type="search"], 
    input[type="email"], 
    input[type="password"], 
    input[type="url"], 
    input[type="tel"], 
    input[type="time"], 
    input[type="date"], 
    input[type="datetime-local"], 
    textarea, select) {
        font-size: 0.85rem;
    }

    .form-field .field-label {
        font-size: 0.85rem;
    }

    .module-key {
        font-size: 0.85rem;
    }
}

/* HD / WUXGA (1920x1080, 1920x1200) */

@media (min-width: 1601px) and (max-width: 2879px) {
    /* standard styles */
}

/* 4K (3840x2160) */

@media (min-width: 2880px) {

    .widget-customize-panel {
        max-width: none;
        width: 90vw;
        padding: 2rem;
        gap: 2rem;
    }

    .panel-title h3 {
        font-size: 3rem;
    }

    .close-customize-button.cancel {
        font-size: 3rem;
    }

    .widget-customize-panel .customize-content {
        gap: 1rem;
    }

    .customize-content p {
        font-size: 2rem;
    }

    .profile-name-input {
        padding: 0.75rem 1rem;
        border: 2px solid rgba(255, 255, 255, 0.2);
        font-size: 2rem;
    }

    th, tr, td {
        font-size: 2rem;
    }

    /* EDIT CALIBRATION PANEL */

    .calibration-edit-overlay .calibration-panel {
        max-width: none;
        width: 90vw;
    }

    .calibration-row {
        gap: 1rem;
    }

    .calibration-row label {
        font-size: 2rem;
    }

    .calibration-row input[type=text],
    .calibration-row input[type=number],
    .form-field input[type=text],
    .form-field input[type=number] {
        font-size: 2rem;
    }

    .sensor-radio-list.small {
        max-height: 16rem;
    }

    .calibration-row label.sensor-radio, .sensor-radio {
        font-size: 2rem;
    }

    .remove-alarm {
        width: 3rem;
        height: 3rem;
        font-size: 1.75rem;
    }

    .calibration-row .number-input {
        font-size: 2rem !important;
    }

    .widget-customize-panel .custom-select {
        font-size: 2rem;
    }

    .minmax-calib, .set-alarm {
        padding: 1rem 2rem;
        font-size: 2rem;
    }

    .field-label {
        font-size: 2rem;
    }

    .widget-customize-panel .custom-column {
        gap: 2rem;
    }

    .hint-icon .hint-text {
        max-width: 500px;
    }

    .light-checkbox {
        font-size: 1.75rem;
    }

    /* WIDGET CREATOR PANEL */

    .close-customize-button {
        font-size: 3rem;
    }

    .widget-disabled-overlay {
        width: 100%;
        padding: 1rem;
    }

    .widget-disabled-overlay strong {
        font-size: 2rem;
    }

    .widget-disabled-overlay ul {
        font-size: 2rem;
    }

    .widget-field-control, 
    .widget-customize-panel :is(input[type="text"], 
    input[type="number"], 
    input[type="search"], 
    input[type="email"], 
    input[type="password"], 
    input[type="url"], 
    input[type="tel"], 
    input[type="time"], 
    input[type="date"], 
    input[type="datetime-local"], 
    textarea, select) {
        font-size: 2rem;
    }
}

/* Low height */

@media (min-width: 1000px) and (max-height: 650px) {
    .widget-delete-button {
        top: 0.25rem;
        width: 2rem;
        height: 2rem;
    }

    .widget-clipboard-button {
        top: 0.25rem;
        width: 2rem;
        height: 2rem;
    }

    .widget-edit-button {
        top: 0.25rem;
        width: 2rem;
        height: 2rem;
    }

    .widget-disabled-overlay {
        padding: 0.5rem;
        font-size: 0.75rem !important;
        border-radius: 0.25rem;
    }
}

/* Override for 1024x600 */

@media (width: 1024px) and (height: 600px) {
    .widget-delete-button {
        top: 0.25rem;
        width: 2rem;
        height: 2rem;
    }

    .widget-clipboard-button {
        top: 0.25rem;
        width: 2rem;
        height: 2rem;
    }

    .widget-edit-button {
        top: 0.25rem;
        width: 2rem;
        height: 2rem;
    }

    .widget-disabled-overlay {
        padding: 0.5rem;
        font-size: 0.75rem !important;
        border-radius: 0.25rem;
    }
}