﻿:root {
    --app-safe-height: var(--app-height, 100dvh);
    --app-min-dimension: min(100vw, var(--app-safe-height));
    --app-base-unit: clamp(0.85rem, calc(var(--app-min-dimension) / 50), 1.75rem);
    --page-title-measured: 64px;
}

/* BUTTONS --- start */

button {
    user-select: none;
    touch-action: manipulation; /* without zoom/select */
    -webkit-user-select: none; /* Safari, iOS */
    -ms-user-select: none; /* Old Edge */
    -webkit-touch-callout: none; /* iOS */
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    border: 1px solid transparent;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 300;
    font-size: 0.95rem;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn:disabled,
.btn[disabled] {
    background-color: #6A6A6A;
    border-radius: 0.25rem;
    border-color: #ababab;
    opacity: 0.6;
    cursor: not-allowed;
}

.btn:focus, .btn:active, .btn:active:focus {
    border-width: 4px;
    border-color: rgb(0, 229, 226);
    box-shadow: unset;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

.btn-primary {
    background-color: #00E5E2;
    border-color: #00E5E2;
    color: #001A1A;
}

.btn-primary:hover:not(:disabled) {
    background-color: #00b8b6;
    border-color: #00b8b6;
    color: #001A1A;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: inherit;
}

.btn-secondary:hover:not(:disabled) {
    background-color: rgba(0, 229, 226, 0.2);
    border-color: #00E5E2;
    color: #0FF5F3;
}

.btn-danger {
    background-color: rgba(227, 41, 64, 0.25);
    border-color: rgba(227, 41, 64, 0.55);
    color: #FFECEF;
}

.btn-danger:hover:not(:disabled) {
    background-color: rgba(227, 41, 64, 0.4);
    border-color: rgba(227, 41, 64, 0.7);
    color: #FFFFFF;
}

.btn-outline-primary {
    background-color: transparent;
    border-color: #00E5E2;
    color: #00E5E2;
}

.btn-outline-primary:hover:not(:disabled) {
    background-color: rgba(0, 229, 226, 0.15);
    border-color: #00E5E2;
    color: #E4FFFF;
}

.btn-outline-danger {
    background-color: transparent;
    border-color: rgba(227, 41, 64, 0.7);
    color: #FFECEF;
}

.btn-outline-danger:hover:not(:disabled) {
    background-color: rgba(227, 41, 64, 0.2);
    border-color: rgba(227, 41, 64, 0.7);
    color: #FFFFFF;
}

/* end --- BUTTONS */



/* LAYOUT --- start */

.layout-root {
    width: 100%;
    height: 100dvh;
    overflow: hidden;
}

.background-overlay {
    position: absolute;
    background-image: url('/images/weather/weather-sunny-bg.png');
    background-attachment: fixed;
    background-size: cover;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.background-overlay.light {
    background: radial-gradient(ellipse at center, #ffffff 0%, #e3e3e3 100%);
}

.background-overlay.dark {
    background: radial-gradient(ellipse at center, #2c2a2a 0%, #000000 100%);
}

.background-overlay.navy {
    background: radial-gradient(ellipse at center, #073563 0%, #000000 100%);
}

.background-overlay.ocean {
    background: radial-gradient(ellipse at center, #14d3cd 0%, #0083b0 100%);
}

.background-overlay.default {
    background-image: url('/images/weather/weather-sunny-bg.png');
}
.background-overlay.default.sunny {
    background-image: url('/images/weather/weather-sunny-bg.png');
}
.background-overlay.default.cloudy {
    background-image: url('/images/weather/weather-cloudy-bg.png');
}
.background-overlay.default.fog {
    background-image: url('/images/weather/weather-fog-bg.png');
}
.background-overlay.default.rain {
    background-image: url('/images/weather/weather-rain-bg.png');
}
.background-overlay.default.snow {
    background-image: url('/images/weather/weather-snow-bg.png');
}
.background-overlay.default.storm {
    background-image: url('/images/weather/weather-storm-bg.png');
}

/* end --- LAYOUT */



/* MAIN PANEL --- start */

.main-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--footer-height);
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0.2% 0.2% 0.2% 0.2%;
    overflow-y: auto;
    overflow-x: hidden;
    touch-action: pan-x pan-y; /* allow horizontal swipe gestures to reach scrollable panels */
    -ms-touch-action: pan-x pan-y;
}

.main-panel.no-footer {
    bottom: 0;
}

.footer {
    height: 8%;
    background-color: rgba(0, 0, 0, 0.6);
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    gap: 1%;
    padding-left: 1%;
    touch-action: none;
    -ms-touch-action: none;
    --footer-logo-width: clamp(120px, 12vw, 220px);
    --footer-pill-unit: var(--app-base-unit);
}

.page-title {
    width: 100%;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    background-color: rgba(0, 0, 0, 0.6);
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1300;
}

.page-title span {
    font-weight: 500;
    font-size: 0.95rem;
    color: #00E5E2;
    text-transform: uppercase;
}

.page-buttons {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.scheduler-title span {
    margin-left: 0%;
}

.page-title input.page-rename-input {
    width: 40%;
    padding-left: 0.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.25rem;
    color: #00E5E2;
    font-weight: 500;
    font-size: clamp(12px, 4vh, 24px);
}

/* tabs */

.panel-tabs-shell {
    width: 100%;
    min-height: 0;
    margin-top: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1 1 auto;
}

.panel-tabs {
    width: 100%;
    padding: 0.25rem 0.5rem;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex: 0 0 auto;
    font-size: clamp(12px, 4vh, 24px);
}

.panel-tab {
    display: inline-flex;
    justify-content: center;
    min-width: 15%;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    user-select: none;
}

.panel-tab-reorder {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0.25rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.panel-tab-reorder.active {
    border-color: #00E5E2;
    color: #00E5E2;
    background-color: rgba(0, 229, 226, 0.1);
}

.panel-tab-reorder[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.panel-tab-add {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.5);
    border-radius: 0.25rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.panel-tab-add:hover {
    border-color: #00E5E2;
    color: #00E5E2;
}

.panel-tab-disable {
    padding: 0.25rem 0.5rem;
    background-color: rgba(227, 41, 64, 0.25);
    border: 1px solid rgba(227, 41, 64, 0.55);
    border-radius: 0.25rem;
    font-size: 0.95rem;
    color: #FFECEF;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.panel-tab-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    color: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 6rem;
    padding: 0 0.25rem;
}

.panel-tab-input:focus {
    outline: none;
    border-bottom-color: #00E5E2;
}

/* end --- MAIN PANEL */



/* ??? */

.panel-tabs-shell.tabs-enabled {
    gap: 0;
}

.panel-tabs-shell.tabs-position-top {
    flex-direction: column;
}

.panel-tabs-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    min-height: 0;
}



.panel-tabs-main,
.panel-tabs-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.panel-tabs-main {
    flex: 1 1 auto;
    width: 100%;
}

.panel-tabs-controls {
    width: 100%;
    justify-content: center;
}

.panel-tab-handle {
    color: rgba(255, 255, 255, 0.7);
    cursor: grab;
    font-size: 1.1rem;
    line-height: 1;
    user-select: none;
}

.panel-tab-handle:hover {
    color: #00E5E2;
}

.panel-tab:hover {
    border-color: rgba(0, 229, 226, 0.7);
    color: #0FF5F3;
}

.panel-tab:focus {
    outline: 2px solid rgba(0, 229, 226, 0.5);
}

.panel-tab.active {
    border-color: #00E5E2;
    background-color: rgba(0, 229, 226, 0.25);
    color: #00E5E2;
}

.panel-tab span {
    pointer-events: none;
    font-weight: 600;
    letter-spacing: 0.02em;
    font-size: clamp(8px, 3vh, 18px);
}

.panel-tab-remove {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 2rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.25rem;
    width: 1.9rem;
    height: 1.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.panel-tab-remove:hover {
    color: #ffb3b3;
}

.panel-tabs-main.reorder-mode .panel-tab {
    cursor: grab;
    touch-action: none;
}

.panel-tabs-main.reorder-mode .panel-tab-input {
    pointer-events: none;
}

.panel-tabs-main.reorder-mode .panel-tab.active {
    border-style: dashed;
}

.panel-tab-disable[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.panel-tab-disable:not([disabled]):hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.panel-tabs.panel-tabs-disabled {
    justify-content: flex-end;
}

.page-button {
    min-height: calc(var(--app-base-unit) * 2);
    padding: 0 1rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: var(--app-base-unit);
}

.wide-button {
    min-width: calc(var(--app-base-unit) * 6);
    white-space: nowrap;
    text-align: center;
}

.checkbox-button {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--app-base-unit);
}

#silent-toggle {
    accent-color: #00E5E2;
    display: none;
}

#silent-toggle:checked + label {
        background: rgba(0, 229, 226, 0.3);
        border-color: #00E5E2;
        color: #E4FFFF;
/*        box-shadow: 0 0 1vh #00E5E2;*/
}

.page-button.active {
    background: rgba(0, 229, 226, 0.3);
    border-color: #00E5E2;
    color: #E4FFFF;
    box-shadow: 0 0 calc(var(--app-base-unit) * 0.5) #00E5E2;
}

.edit-button {
    padding:1vh;
    margin-right: 0.5%;
    height: 5vh;
    width: 5vh;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 1.5vh;
    cursor: pointer;
}

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

    .edit-button .checkmark-icon {
        width: 3vh;
        height: 3vh;
        font-size: 3vh;
        font-weight: bold;
        line-height: 1;
        color: #FFFFFF;
    }

.scheduler-shortcut-button {
    font-size: 1.4rem;
    margin-right: 0.35rem;
}

.scheduler-shortcut-icon {
    line-height: 1;
}
.cross-icon {
    font-size: calc(var(--app-base-unit) * 1.6);
    font-weight:bold;
    line-height: 1;
    color: #FFFFFF;
}

.mute-icon {
    font-size: 1.2rem;
    line-height: 1;
    display: inline-block;
}

.footer-button {
    width: 10vh;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    z-index: 10;
    transition: background-color 0.2s;
}

/* allow icon scaling on hover */
.footer-button .footer-nav-button {
    transition: transform 0.5s;
    width: 100%;
    height: 100%;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.footer-button .footer-nav-button:focus {
    outline: none;
}

.home-button .footer-nav-button {
    background-image: url('/images/footer/menu-home.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.home-button.active .footer-nav-button {
    background-image: url('/images/footer/menu-home-active.png');
}

.panels-button .footer-nav-button {
   background-image: url('/images/footer/menu-widgets.png');
   background-size: contain;
   background-repeat: no-repeat;
   background-position: center;
}

.panels-button.active .footer-nav-button {
    background-image: url('/images/footer/menu-widgets-active.png');
}

.scheduler-button .footer-nav-button {
    background: none;
    font-size: calc(var(--app-base-unit) * 2.3);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scheduler-button .footer-nav-button::before {
    content: "\1F4C5";
}

.scheduler-button.active .footer-nav-button {
    color: #86b4ff;
}

.alarms-button .footer-nav-button {
    background-image: url('/images/footer/menu-alarms.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.alarms-button.active .footer-nav-button {
    background-image: url('/images/footer/menu-alarms-active.png');
}

.alarms-button.emergency .footer-nav-button {
    background-image: url('/images/footer/menu-alarms-emergency.png');
}


.alarms-button.active {
    color: #b00020;
}

.alarms-button.active .alarm-count {
    color: white;
}

.alarms-button {
    position: relative;
    color: white;
}

.alarms-button .alarm-count {
    position: absolute;
    right: 0.2rem;
    bottom: 0.2rem;
    font-size: var(--app-base-unit);
    pointer-events: none;
    color: inherit;
}

.alarms-button .alarm-count.has-alarms {
    color: #b00020;
}

.alarms-button.pulse-red .footer-nav-button {
    animation: footer-alarm-red-pulse 1s linear infinite;
}

.alarms-button.pulse-yellow .footer-nav-button {
    animation: footer-alarm-yellow-pulse 1s linear infinite;
}

.silent-button {
    position: relative;
    color: #ffffff;
}

.silent-button .silent-toggle {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    background-image: url('/images/footer/sound-on.png');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}

.silent-button .silent-toggle:focus {
    outline: none;
}

@media (hover: hover) {
    .silent-button:hover .silent-toggle {
        transform: scale(1.1);
        background-image: url('/images/footer/sound-on-active.png');
    }
}

@media (hover: none) {
    .silent-button:active .silent-toggle {
        transform: scale(1.1);
    }
}

.silent-button.active .silent-toggle {
    background-image: url('/images/footer/sound-off.png');
}

.silent-button.active:hover .silent-toggle,
.silent-button.active:active .silent-toggle,
.silent-button.active:focus-visible .silent-toggle {
    background-image: url('/images/footer/sound-off-active.png');
}

.module-config-button.pulse-green .footer-nav-button {
    animation: footer-module-green-pulse 1s ease-in-out infinite;
}

.module-config-button.pulse-cyan .footer-nav-button {
    animation: footer-module-cyan-pulse 1s ease-in-out infinite;
}

.module-config-button .footer-nav-button {
    background-image: url('/images/footer/menu-new-module.png');
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.module-config-button.active .footer-nav-button {
    background-image: url('/images/footer/menu-new-module-active.png');
}

.footer-button.home-button {
    width: 10vh;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    z-index: 10;
}

.settings-button .footer-nav-button {
    background-image: url('/images/footer/menu-settings.png');
    width: 100%;
    display: block;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}



.footer-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
}

.footer-logo {
    width: var(--footer-logo-width);
    height: 70%;
    background-image: url('/images/footer/logo-yacht-concept.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.footer-connectivity {
    --pill-gap: calc(var(--footer-pill-unit) * 0.4);
    --pill-padding-y: calc(var(--footer-pill-unit) * 0.35);
    --pill-padding-x: calc(var(--footer-pill-unit) * 0.7);
    --pill-radius: calc(var(--footer-pill-unit) * 1.6);
    --pill-font-size: clamp(0.75rem, calc(var(--footer-pill-unit) * 1.05), 1.1rem);
    --pill-dot-size: clamp(0.55rem, calc(var(--footer-pill-unit) * 0.55), 0.9rem);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(calc(var(--footer-logo-width) / 2 + 0.75rem), -50%);
    display: flex;
    align-items: center;
    gap: var(--pill-gap);
    padding: var(--pill-padding-y) var(--pill-padding-x);
    border-radius: var(--pill-radius);
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    font-size: var(--pill-font-size);
    box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
}

.footer-connectivity .status-dot {
    width: var(--pill-dot-size);
    height: var(--pill-dot-size);
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 0 10px #94a3b8;
}

.footer-connectivity.online .status-dot {
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
}

.footer-connectivity.unstable .status-dot {
    background: #facc15;
    box-shadow: 0 0 10px #facc15;
}

.footer-connectivity.offline .status-dot {
    background: #f87171;
    box-shadow: 0 0 10px #f87171;
}

.footer-connectivity .status-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.footer-connectivity .status-label {
    font-weight: 700;
    letter-spacing: 0.01em;
}

@media (hover: hover) {
    .footer-button:hover {
        background-color: transparent;
    }

    .footer-button:hover .footer-nav-button {
        transform: scale(1.1);
    }
}

@media (hover: none) {
    .footer-button:active {
        background-color: transparent;
    }

    .footer-button:active .footer-nav-button {
        transform: scale(1.1);
    }
}

.footer-right {
    margin-left: auto;
    margin-right: 1%;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-time {
    color: white;
    font-size: 0.95rem;
    white-space: nowrap;
    user-select: none;
}

.footer-time .date-part {
    margin-left: 0.5rem;
}


/* SETTINGS PAGE --- start */

.settings-page {
    width: 100%;
    height: calc(100% - 6%);
    padding: var(--app-base-unit) calc(var(--app-base-unit) * 0.5);
    display: flex;
    gap: 2rem;
    overflow-y: auto;
    touch-action: pan-y;
    -ms-touch-action: pan-y;
}

.settings-container {
    width: 100%;
    height: 100%;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 2rem;
    overflow-x: hidden;
    overflow-y: auto;
}

/* SETTINGS */

.settings-item {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 1rem;
}

.settings-item-label {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    font-weight: 300 !important;
}

.description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin: 0 !important;
}

.settings-container.light .description,
.company-info.light .description,
.company-info.default .description {
    color: rgba(15, 23, 42, 0.7);
}

/* theme */

.theme-options {
    width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.theme-option {
    min-width: 45%;
    font-size: 1.25rem;
}

.theme-option input[type="radio"] {
    display: none;
}

.theme-option label {
    padding: 0.4rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    background-color: rgba(0, 0, 0, 0.2);
    color: inherit;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
}

.theme-swatch {
    width: 2rem;
    height: 1rem;
    border-radius: 0.2rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.theme-swatch.light {
    background: radial-gradient(ellipse at center, #ffffff 0%, #e3e3e3 100%);
}

.theme-swatch.dark {
    background: radial-gradient(ellipse at center, #2c2a2a 0%, #000000 100%);
}

.theme-swatch.navy {
    background: radial-gradient(ellipse at center, #073563 0%, #000000 100%);
}

.theme-swatch.ocean {
    background: radial-gradient(ellipse at center, #14d3cd 0%, #0083b0 100%);
}

.theme-swatch.default {
    background-image: url('/images/weather/weather-sunny-bg.png');
    background-size: cover;
}

.settings-container.light .theme-option label {
    background-color: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.3);
}

.theme-option input[type="radio"]:checked + label {
    border-color: #00E5E2;
    border-width: 1px;
    background-color: rgba(0, 0, 0, 0.4);
}

.settings-container.light .theme-option input[type="radio"]:checked + label {
    background-color: rgba(0,0,0,0.3);
}

.settings-container.light {
    color: #111111;
    background-color: rgba(0,0,0,0.1);
}

.layout-root.light {
    color: #222222;
}

.settings-container.dark {
    color: #ffffff;
}

.layout-root.dark {
    color: #ffffff;
}

.settings-container.navy {
    color: #ffffff;
}

.layout-root.navy {
    color: #ffffff;
}

.settings-container.ocean {
    color: #ffffff;
}

.layout-root.ocean {
    color: #ffffff;
}


.settings-container.default {
    color: #ffffff;
}

.layout-root.default {
    color: #ffffff;
}

.settings-link {
    margin: 2rem 1rem;
    font-size: calc(var(--app-base-unit) * 1.25);
}

.settings-link a {
    color: #00E5E2;
    text-decoration: underline;
}

/* calibration buttons adapt to light theme */

.layout-root.light .btn-secondary,
.layout-root.light .close-calibration,
.layout-root.light .minmax-calib,
.layout-root.light .alarm-management button.btn-secondary {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid currentColor;
}

.layout-root.light .btn-secondary:hover:not(:disabled), .layout-root.light .alarm-management button.btn-secondary:hover:not(:disabled) {
    background: rgba(0, 229, 226, 0.4);
    border: 1px solid rgba(0, 229, 226, 0.6);
    color: #E4FFFF;
}

.force-confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding-bottom: 0.5rem;
    align-items: center;
}

/* keyboard */

.settings-item.settings-device-keyboard {
    flex-direction: row;
    align-items: center;
}

/* time zone*/

.settings-container .timezone-select {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.32);
    background: rgba(15, 26, 46, 0.55);
    box-shadow: 0 10px 26px rgba(7, 14, 31, 0.45);
    color: #f8fafc;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: 0.01em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    backdrop-filter: blur(8px);
}

.settings-container .timezone-select:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

.settings-container.light .timezone-select,
.settings-container.default .timezone-select {
    background: rgba(248, 250, 252, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.28);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
    color: #0f172a;
}

.settings-container .timezone-select:focus {
    outline: none;
    border-color: rgba(0, 229, 226, 0.7);
    box-shadow: 0 0 0 2px rgba(0, 229, 226, 0.25), 0 14px 28px rgba(4, 12, 24, 0.5);
}

.settings-container.light .timezone-select:focus,
.settings-container.default .timezone-select:focus {
    border-color: rgba(37, 99, 235, 0.75);
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.35), 0 14px 28px rgba(15, 23, 42, 0.2);
}

/* buttons */

.settings-item .buttons-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.settings-item .buttons-wrapper .btn {
    flex: 1 1 30%;
}

/* COMPANY INFO */

.company-info {
    width: 100%;
    height: 100%;
    padding: 1rem;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.company-info .settings-item {
    align-items: center;
}

.company-info.light {
    color: #111111;
    background-color: rgba(0,0,0,0.1);
}

.company-info.dark,
.company-info.navy,
.company-info.ocean,
.company-info.default {
    color: #ffffff;
    background-color: rgba(0, 0, 0, 0.5);
}

/* media */

.media-container {
    display: flex;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.media-qr {
    width: 8rem;
    height: 8rem;
    background-image: url(/images/media/yc-qr.png);
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.media-items {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 0.5rem;
}

.media-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.media-icon {
    width: 1rem;
    height: 1rem;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.media-link {
    font-size: 0.9rem;
}

#mail {
    background-image: url(/images/media/mail-icon.png);
}

#website {
    background-image: url(/images/media/website-icon.png);
}

#instagram {
    background-image: url(/images/media/instagram-icon.png);
}

#linkedin {
    background-image: url(/images/media/linkedin-icon.png);
}

#facebook {
    background-image: url(/images/media/facebook-icon.png);
}

#youtube {
    background-image: url(/images/media/youtube-icon.png);
}

/* list */

.company-info-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.company-info-list ul {
    max-width: 40%;
    font-size: 0.95rem;
}

.company-info-list li {
    text-transform: capitalize;
}

/* end --- SETTINGS PAGE */



/* KEYFRAMES --- start */

@keyframes footer-alarm-red-pulse {
    0%, 100% { 
        filter: brightness(1) drop-shadow(0 0 0.2rem #502800);
    }
    25%, 75% { 
        filter: brightness(1.2) drop-shadow(0 0 0.8rem #b00020);
    }
    50% { 
        filter: brightness(1.5) drop-shadow(0 0 1rem #fff);
    }
}

@keyframes footer-alarm-yellow-pulse {
    0%, 100% { 
        filter: brightness(1) drop-shadow(0 0 0.2rem #502800);
    }
    25%, 75% { 
        filter: brightness(1.2) drop-shadow(0 0 0.8rem #F1C40F);
    }
    50% { 
        filter: brightness(1.5) drop-shadow(0 0 1rem #fff);
    }
}

@keyframes footer-module-green-pulse {
    from { 
        filter: brightness(1) drop-shadow(0 0 0.4rem #00FF00);
    }
    50% { 
        filter: brightness(1.3) drop-shadow(0 0 1.2rem #00FF00);
    }
    to { 
        filter: brightness(1) drop-shadow(0 0 0.4rem #00FF00);
    }
}

@keyframes footer-module-cyan-pulse {
    from { 
        filter: brightness(1) drop-shadow(0 0 0.4rem #00FFFF);
    }
    50% { 
        filter: brightness(1.3) drop-shadow(0 0 1.2rem #00FFFF);
    }
    to { 
        filter: brightness(1) drop-shadow(0 0 0.4rem #00FFFF);
    }
}

/* end --- KEYFRAMES */




/* Custom select */
.custom-select {
    position: relative;
    background: #111;
    border: 1px solid #4C4C4C;
    color: white;
    padding: 0.5em;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    user-select: none;
    font-size: 1rem;
}

.selected-value::after {
    content: '▼';
    float: right;
    margin-left: 8px;
    font-size: 0.7em;
}

.custom-options {
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    right: 0;
    background: #222;
    border: 1px solid #4C4C4C;
    z-index: 1000;
    border-radius: 0 0 4px 4px;
}

.custom-select.is-open .selected-value::after {
    transform: rotate(180deg);
}

.custom-option {
    padding: 0.5em;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-option:hover {
   background: rgba(0, 229, 226, 0.2);
}

.custom-option.selected {
   background: #00E5E2;
   color: black;
   font-weight: bold;
}

.custom-option.active {
    background: rgba(0, 229, 226, 0.25);
}

.custom-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.widget-template .template-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.widget-template .template-existing-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    padding: 0 0.35rem;
    background: rgba(0, 229, 226, 0.18);
    color: #00e5e2;
    border: 1px solid rgba(0, 229, 226, 0.45);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.4;
}

.widget-template.existing-template {
    position: relative;
    border: 2px solid rgba(0, 229, 226, 0.6);
/*    padding-top: 3.25rem;*/
}

.widget-template.existing-template::after {
    content: "Existing";
    position: absolute;
    top: 0.9rem;
    right: calc(0.75rem + 2.75rem);
    background-color: rgba(0, 183, 255, 0.85);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 999px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.widget-template.library-existing-template {
/*    padding-top: 3.25rem;*/
}

.widget-template.library-existing-template::after {
    display: none;
}

.template-inspect-button,
.template-delete-button {
    position: absolute;
    top: 0.75rem;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 229, 226, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    z-index: 20;
}

.template-inspect-button {
    right: 3.25rem;
}

.template-delete-button {
    right: 0.75rem;
}

.template-inspect-button-icon,
.template-delete-button-icon {
    width: 1.35rem;
    height: 1.35rem;
    object-fit: contain;
    filter: brightness(1.05);
}

.template-delete-button-icon {
    filter: brightness(1.15);
}

.template-inspect-button:hover,
.template-delete-button:hover {
    transform: translateY(-1px);
}

.template-inspect-button:hover {
    background: rgba(0, 229, 226, 0.3);
    border-color: rgba(0, 229, 226, 0.65);
    color: #e4ffff;
}

.template-delete-button:hover {
    background: rgba(255, 87, 87, 0.35);
    border-color: rgba(255, 87, 87, 0.75);
    color: #ffeaea;
}

.template-inspect-button:focus-visible,
.template-delete-button:focus-visible {
    outline: 2px solid rgba(0, 229, 226, 0.8);
    outline-offset: 2px;
}

.widget-reuse-overlay {
    padding: clamp(1.5rem, 4vw, 4rem);
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.widget-reuse-dialog {
    --reuse-preview-header: clamp(3.75rem, 6vh, 4.75rem);
    --reuse-preview-footer: clamp(4.5rem, 7vh, 6.5rem);
    --reuse-preview-vertical-padding: clamp(1.25rem, 2.4vw, 2.6rem);
    --reuse-preview-available: calc(var(--app-height) - var(--footer-height) - var(--footer-gap) - var(--reuse-preview-header) - var(--reuse-preview-footer) - (2 * var(--reuse-preview-vertical-padding)));
    --reuse-preview-cell: var(--reuse-preview-cell-override, clamp(90px, 7vw, 132px));
    --reuse-preview-gap-size: var(--reuse-preview-gap-override, clamp(8px, 1vw, 14px));
    --reuse-preview-height: clamp(220px, 55vh, var(--reuse-preview-available));
    position: relative;
    width: clamp(720px, 92vw, 1200px);
    max-height: calc(var(--app-height) - var(--footer-height) - var(--footer-gap));
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: var(--reuse-preview-vertical-padding);
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 36px 96px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 2.6vw, 2.5rem);
    color: #f4fbff;
    overflow: hidden;
    box-sizing: border-box;
}

.widget-reuse-overlay .widget-customize-panel {
    max-width: 100%;
    overflow: hidden;
}

.existing-definition-overlay {
    padding: clamp(1.5rem, 4vw, 4rem);
    z-index: 1200;
}

.existing-definition-panel {
    width: clamp(640px, 90vw, 960px);
    max-height: calc(var(--app-height) - var(--footer-height) - var(--footer-gap));
    display: flex;
    flex-direction: column;
    gap: clamp(1.25rem, 2vw, 2rem);
    overflow-y: auto;
}

.existing-definition-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
}

.existing-definition-title h3 {
    margin: 0;
}

.existing-definition-title p {
    margin: 0.35rem 0 0;
    color: rgba(228, 249, 255, 0.7);
    font-size: 0.95rem;
}

.existing-definition-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
}

.existing-definition-meta-item {
    padding: 0.75rem 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.existing-definition-meta-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(228, 249, 255, 0.65);
}

.existing-definition-meta-value {
    font-size: 1rem;
    font-weight: 600;
    color: #f5fcff;
    word-break: break-word;
}

.existing-definition-settings {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.existing-definition-settings h4 {
    margin: 0;
    font-size: 1.1rem;
}

.existing-definition-settings-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem 1rem;
}

.existing-definition-setting {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.6rem;
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.existing-definition-setting dt {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(228, 249, 255, 0.75);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.existing-definition-setting dd {
    margin: 0;
    font-size: 0.95rem;
    color: #f5fcff;
    word-break: break-word;
}

.existing-definition-empty {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(228, 249, 255, 0.75);
}

@supports (height: 100dvh) {
.widget-reuse-dialog {
        --reuse-preview-available: calc(100dvh - var(--footer-height) - var(--footer-gap) - var(--reuse-preview-gap));
        max-height: calc(100dvh - var(--footer-height) - var(--footer-gap));
    }
}

.reuse-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
}

.reuse-dialog-title h3 {
    font-size: 2rem;
}

.reuse-dialog-title p {
    margin: 0;
    line-height: 1.55;
    color: rgba(214, 235, 255, 0.82);
    max-width: 60ch;
}

.reuse-dialog-content {
    min-height: 0;
    max-height: var(--reuse-preview-available);
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 2.5vw, 2.5rem);
}

.reuse-dialog-instructions {
    font-size: 1.05rem;
    color: rgba(210, 233, 255, 0.82);
}

.reuse-new-section {
    display: flex;
    flex-direction: column;
    gap: clamp(0.9rem, 2vw, 1.75rem);
}

.reuse-content-grid {
    height: 100%;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 5rem;
}

.reuse-content-grid.existing-layout,
.reuse-content-grid.create-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.9fr);
}

.widget-reuse-dialog .reuse-preview-column,
.widget-reuse-dialog .reuse-template-option,
.widget-reuse-dialog .reuse-template-option .widget-template {
    height: auto;
    min-height: 40vh !important;
}

.widget-reuse-dialog .reuse-preview-column {
    max-height: var(--reuse-preview-available);
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: stretch;
    overflow: hidden;
}

.widget-reuse-dialog .reuse-template-option {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    height: 100%;
}

.reuse-new-section h4 {
    margin: 0;
    font-size: 1.15rem;
    color: #f4fbff;
}

.reuse-new-section .reuse-template-option {
    align-self: flex-start;
    max-width: min(100%, 460px);
}

.widget-reuse-dialog .reuse-quantity-column {
    display: flex;
    align-items: flex-start;
}

.widget-reuse-dialog .reuse-actions-column {
    min-width: 30%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: space-between;
}

.widget-reuse-dialog .reuse-actions.with-quantity.vertical {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: space-between;
    gap: 10rem;
}

.reuse-quantity-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #f3f7ff;
}

.reuse-quantity-input {
    width: 100%;
    min-width: 0;
    padding: 0.4rem 0.6rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(12, 20, 30, 0.6);
    color: #f3f7ff;
}

.reuse-quantity-input:disabled {
    opacity: 0.7;
}

.reuse-quantity-hint {
    font-size: 0.95rem;
    color: rgba(244, 251, 255, 0.75);
}

.reuse-choice {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.75rem, 2vw, 2rem) clamp(2rem, 4vw, 4.5rem);
    padding: clamp(0.85rem, 2vw, 1.5rem) clamp(1.25rem, 3vw, 2rem);
    border-radius: 0.85rem;
    background: rgba(9, 16, 26, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.reuse-choice label {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    color: #f4fbff;
}

.reuse-choice input[type="radio"] {
    accent-color: #00e5e2;
}

.reuse-existing-section {
    display: flex;
    flex-direction: column;
    gap: clamp(1.25rem, 2vw, 2rem);
    flex: 1;
    min-height: 0;
}

.reuse-existing-hint {
    font-size: 1.05rem;
    color: rgba(210, 233, 255, 0.82);
}

.reuse-existing-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: clamp(1.25rem, 2.5vw, 2.5rem);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: clamp(1.25rem, 2.5vw, 2.75rem);
    margin: 0;
    background: rgba(6, 12, 20, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.reuse-template-option {
    background: rgba(20, 20, 20, 0.8);
    border-radius: 0.9rem;
    padding: clamp(1rem, 2.4vw, 1.75rem);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    display: flex;
    flex-direction: column;
    gap: clamp(0.85rem, 2vw, 1.25rem);
    min-width: 0;
    align-items: center;
    width: max-content;
    max-width: 100%;
}

.reuse-template-option:hover {
    border-color: rgba(0, 229, 226, 0.55);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    transform: translateY(-2px);
}

.reuse-template-option.selected {
    border-color: rgba(0, 229, 226, 0.7);
}

.widget-reuse-dialog .reuse-template-option .widget-template {
    width: max-content;
/*    max-width: min(100%, calc(var(--reuse-natural-width) + clamp(1.2rem, 3vw, 2.8rem)));*/
    height: max-content;
    min-width: 0;
    padding: 0.5rem;
    align-self: center;
    justify-self: center;
    display: flex;
    flex-direction: column;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    --reuse-cell-size: var(--reuse-preview-cell);
    --reuse-gap-size: var(--reuse-preview-gap-size);
    --reuse-natural-width: calc((var(--var-width, 1) * var(--reuse-cell-size)) + (max(var(--var-width, 1) - 1, 0) * var(--reuse-gap-size)));
    --reuse-natural-height: calc((var(--var-height, 1) * var(--reuse-cell-size)) + (max(var(--var-height, 1) - 1, 0) * var(--reuse-gap-size)));
    --reuse-available-height: var(--reuse-preview-available);
    --reuse-available-width: min(100%, calc(var(--reuse-available-height) * (var(--var-width, 1) / var(--var-height, 1))));
    --reuse-scale-x: min(1, calc(var(--reuse-available-width) / var(--reuse-natural-width)));
    --reuse-scale-y: min(1, calc(var(--reuse-available-height) / var(--reuse-natural-height)));
    --reuse-scale: min(var(--reuse-scale-x), var(--reuse-scale-y), 1);
}

.widget-reuse-dialog .reuse-template-option .widget-template .template-info {
    width: 100%;
    margin-bottom: clamp(0.65rem, 1.5vw, 1rem);
}

.widget-reuse-dialog .reuse-template-option .widget-template .template-content {
    position: relative;
    width: 100%;
    height: 100%;
/*    max-width: min(100%, calc(var(--reuse-natural-width) + clamp(1.2rem, 3vw, 2.8rem)));*/
    max-height: var(--reuse-available-height);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: clamp(0.6rem, 1.5vw, 1.35rem);
    background: rgba(0, 0, 0, 0.45);
    border-radius: 0.65rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.widget-reuse-dialog .reuse-template-option .widget-template .template-content > * {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.widget-reuse-dialog .reuse-template-option .widget-template .template-content .widget-instance,
.widget-reuse-dialog .reuse-template-option .widget-template .template-content .widget-inner,
.widget-reuse-dialog .reuse-template-option .widget-template .template-content .widget {
    width: auto !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
}

.widget-reuse-dialog.existing-reuse .template-status-pill.unused {
    display: none;
}

.widget-reuse-dialog.existing-reuse .widget-template::after {
    display: none;
}

.widget-reuse-dialog .reuse-template-option .template-content .template-preview-target {
/*    width: var(--reuse-natural-width);*/
    height: var(--reuse-natural-height);
    transform: scale(var(--reuse-scale));
    transform-origin: center;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    max-height: var(--reuse-available-height);
    margin: 0 auto;
}

/* Preview-only widget refinements (kept inside the reuse dialog scope) */
.widget-reuse-dialog .template-preview-target .buttons-widget {
    justify-content: center;
    gap: clamp(0.9rem, 2vw, 1.4rem);
}

.widget-reuse-dialog .template-preview-target .buttons-widget .bulb-name {
    text-align: center;
}

.widget-reuse-dialog .template-preview-target .buttons-widget button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45em;
    font-size: clamp(0.95rem, 2.5vh, 1.35rem);
    min-height: clamp(2.75rem, 6vh, 3.75rem);
    line-height: 1.1;
    padding-inline: clamp(0.85rem, 2vw, 1.4rem);
}

.widget-reuse-dialog .template-preview-target .buttons-widget button svg,
.widget-reuse-dialog .template-preview-target .buttons-widget button img {
    width: 1.4em;
    height: 1.4em;
}

.widget-reuse-dialog .template-preview-target .rgbw-bulb-widget,
.widget-reuse-dialog .template-preview-target .rgbw-slider-widget {
    width: 100%;
    max-width: 100%;
    align-items: stretch;
}

.widget-reuse-dialog .template-preview-target .rgbw-slider-widget .slider-div {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    flex-shrink: 0;
}


.widget-reuse-dialog .template-preview-target input[type="range"]::-webkit-slider-thumb {
    width: 0.9rem;
    height: 0.9rem;
}

.widget-reuse-dialog .template-preview-target input[type="range"]::-moz-range-thumb {
    width: 0.9rem;
    height: 0.9rem;
}

.widget-reuse-dialog .template-preview-target .tank-widget,
.widget-reuse-dialog .template-preview-target .pump-tank-widget,
.widget-reuse-dialog .template-preview-target .fuel-transfer-widget,
.widget-reuse-dialog .template-preview-target .water-system-widget {
    padding: clamp(0.8rem, 1.8vw, 1.4rem);
    gap: clamp(0.7rem, 1.6vw, 1.2rem);
    justify-content: space-between;
}

.widget-reuse-dialog .template-preview-target .tank-widget,
.widget-reuse-dialog .template-preview-target .pump-tank-widget,
.widget-reuse-dialog .template-preview-target .fuel-transfer-widget,
.widget-reuse-dialog .template-preview-target .water-system-widget {
    padding: 0;
}

.widget-reuse-dialog .template-preview-target .pump-tank-content,
.widget-reuse-dialog .template-preview-target .fuel-transfer-widget .tanks {
    align-items: stretch;
    gap: clamp(1.1rem, 2.6vw, 2.4rem);
}

.widget-reuse-dialog .template-preview-target .pump-tank-tank,
.widget-reuse-dialog .template-preview-target .fuel-transfer-widget .tank {
    flex: 0 0 clamp(32%, 36%, 42%);
    max-width: clamp(32%, 36%, 42%);
    align-items: center;
}

.widget-reuse-dialog .template-preview-target .pump-tank-toggles,
.widget-reuse-dialog .template-preview-target .fuel-transfer-widget .transfer-buttons,
.widget-reuse-dialog .template-preview-target .water-system-controls {
    min-height: clamp(58%, 64%, 72%);
}

.widget-reuse-dialog .template-preview-target .tank-wrapper {
    width: clamp(2.9rem, 28%, 4.4rem);
    max-width: clamp(4.6rem, 32%, 6.2rem);
    min-height: clamp(7.5rem, 62%, 10.5rem);
}

.reuse-template-name {
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    color: #f3f7ff;
}

.reuse-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.85rem;
    padding-top: 0.75rem;
}

.reuse-actions.with-quantity {
    align-items: flex-end;
    gap: 1rem;
}

.reuse-actions.existing-actions {
    flex: 1;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 0.65rem;
}

.reuse-actions-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 0.5rem;
    width: 100%;
}

.reuse-actions.existing-actions {
    align-items: center;
}

.reuse-actions.existing-actions .reuse-actions-stack {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.reuse-quantity-hint-centered {
    text-align: center;
    width: 100%;
}

.reuse-quantity-inline {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    width: 210px;
    min-width: 210px;
    max-width: 210px;
}

.reuse-quantity-inline label {
    align-self: flex-start;
}

.reuse-actions-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.reuse-actions.existing-actions .reuse-actions-buttons {
    justify-content: center;
}

.reuse-actions.vertical {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding-top: 0;
}

.reuse-actions .btn {
    min-width: 150px;
}





/* DRAWINGS --- start */

/* title */

.drawings-page-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.5rem;
}

.drawings-page-title.page-title {
    background: none;
    padding: 0;
}

.drawings-page-title .page-title-main {
    width: 100%;
    padding: 0.2rem 0.5rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
}

.drawings-page-title .page-title-heading {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawings-page-title .page-title-actions {
    width: 100%;
    padding: 0.2rem 0.5rem 0.5rem 0.5rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0 , 0.6);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* actions */

.page-title-actions-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 0.5rem;
}

.page-title-actions-content .actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title-actions-content .actions .actions-buttons {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.drawings-page-title.preview-mode .page-title-actions {
    justify-content: end;
}

.drawing-preview-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* cards */

.drawings-grid {
    padding: 0.5rem 0;
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 420px));
    gap: 1.3rem;
    justify-content: center;
}

.drawing-card {
    border: 1px solid rgba(0, 229, 226, 0.22);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.6));
    border-radius: 0.5rem;
    padding: 1rem;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 200ms ease;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.drawing-thumb {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid rgba(0, 229, 226, 0.22);
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
}

.drawing-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.drawing-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    align-items: stretch;
}

.drawing-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.drawing-name {
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-action-btn {
    font-size: 0.95rem;
    font-weight: 750;
}

.drawing-card-actions {
    display: flex;
    position: relative;
}

/* ? */

.drawings-title-caption {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    letter-spacing: 0.01em;
}

.drawings-page-title input[type=file] {
    display: none;
}

.drawing-upload-progress {
    margin: 0.5rem 0 0.25rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(0, 229, 226, 0.22);
    border-radius: 0.85rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.52), rgba(0, 0, 0, 0.66));
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: #e8f8ff;
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.25);
}

.drawing-upload-progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    border: 1px solid rgba(0, 229, 226, 0.3);
}

.drawing-upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00e5e2, #7ac0ff);
    transition: width 140ms ease;
}

.drawing-upload-progress-label {
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.drawing-card.edit-mode {
    border-color: rgba(0, 229, 226, 0.32);
    box-shadow: 0 20px 38px rgba(0, 0, 0, 0.34);
}

.drawing-card:hover,
.drawing-card:focus-visible {
    transform: translateY(-4px);
    border-color: rgba(0, 229, 226, 0.4);
    box-shadow: 0 20px 38px rgba(0, 0, 0, 0.34);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.58), rgba(0, 0, 0, 0.7));
}

.list-edit-actions {
    gap: 0.5rem;
}

.list-edit-actions .btn {
    min-width: 0;
}

.action-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: auto;
    justify-content: center;
    padding-inline: 0.75rem;
}

.action-menu-caret {
    font-size: 0.85em;
    opacity: 0.8;
}

.drawing-card-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    padding: 0.6rem;
    background: rgba(7, 16, 28, 0.92);
    border: 1px solid rgba(0, 229, 226, 0.22);
    border-radius: 0.6rem;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 160px;
    z-index: 10;
}

.drawing-card-menu .btn {
    width: 100%;
    justify-content: center;
}

.drawing-overlay {
    position: fixed;
    top: var(--page-title-measured, 64px);
    right: 0;
    left: 0;
    bottom: calc(var(--footer-height, 0px) + var(--footer-gap, 0px));
    background: #000;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1100;
    box-sizing: border-box;
    height: calc(100dvh - var(--footer-height, 0px) - var(--footer-gap, 0px) - var(--page-title-measured, 64px));
    max-height: calc(100dvh - var(--footer-height, 0px) - var(--footer-gap, 0px) - var(--page-title-measured, 64px));
    --footer-gap: 0px;
}

.drawing-viewport {
    flex: 1;
    min-height: 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
    background: #000;
    touch-action: none;
    height: calc(100dvh - var(--footer-height, 0px) - var(--footer-gap, 0px) - var(--page-title-measured, 64px));
}

.drawing-image {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    max-width: none;
    max-height: none;
    cursor: grab;
    transform-origin: 0 0;
    user-select: none;
    will-change: transform;
    image-rendering: crisp-edges;
}

.drawing-overlay::after {
    content: "";
    position: fixed;
    inset: 0;
    background: #000;
    z-index: -1;
}

.page-content {
    padding: var(--app-base-unit);
}

.hidden-when-preview {
    display: none !important;
}

.drawing-overlay-toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    flex-wrap: wrap;
    overflow: auto;
    max-height: calc(var(--page-title-measured, 64px) * 2.2);
}

.page-title {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.page-title-main {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
}

.drawings-page-title .page-title-main {
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    gap: 1rem;
}

.drawings-page-title.preview-mode .page-title-main {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
}

.drawing-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(121, 192, 255, 0.18);
    border: 1px solid rgba(121, 192, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
}

.drawing-overlay-name {
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawing-overlay-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1200;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.55));
    border: 1px solid rgba(0, 229, 226, 0.18);
    border-radius: 0.85rem;
    padding: 0.65rem 0.85rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.drawing-overlay-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.drawing-overlay-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.drawing-overlay-subtitle {
    margin: 0;
    color: rgba(229, 252, 255, 0.8);
    font-size: 0.9rem;
}

.drawing-overlay-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.drawing-overlay-actions .btn {
    color: #e5fcff;
    border-color: rgba(0, 229, 226, 0.32);
    background: rgba(0, 229, 226, 0.08);
}

.drawing-overlay-actions .btn:hover {
    border-color: rgba(0, 229, 226, 0.6);
    color: #fff;
    background: rgba(0, 229, 226, 0.16);
}

.drawing-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 1600;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.drawing-modal {
    background: linear-gradient(175deg, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.78));
    border: 1px solid rgba(0, 229, 226, 0.2);
    border-radius: 1rem;
    padding: 1.1rem 1.25rem;
    width: min(540px, 95vw);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.38);
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    backdrop-filter: blur(10px);
}

.drawing-modal.drawing-modal-danger, .drawing-modal {
    width: min(760px, 96vw);
    padding: 1rem;
    gap: 1rem;
    border-width: 2px;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55);
}

.drawing-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.drawing-modal-label {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(0, 229, 226, 0.86);
    font-weight: 300;
    font-size: 0.75rem;
}

.drawing-modal-title {
    margin: 0.1rem 0 0;
    font-size: 1.35rem;
    color: #f2fdff;
    display: none;
}

.drawing-modal-danger .drawing-modal-title {
    font-size: 1.6rem;
}

.drawing-modal-body {
    display: grid;
    gap: 0.5rem;
}

.drawing-modal-danger .drawing-modal-body {
    gap: 0.6rem;
}

.drawing-modal-hint {
    font-size: 0.95rem;
    line-height: 1.6;
}

.drawing-modal-input {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(0, 229, 226, 0.28);
    background: rgba(255, 255, 255, 0.04);
    color: #e9f7ff;
    font-weight: 650;
    font-size: 1rem;
    outline: none;
}

.drawing-modal-input:focus {
    border-color: #00E5E2;
    box-shadow: 0 0 0 2px rgba(0, 229, 226, 0.25);
}

.drawing-modal-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.drawing-modal-actions .btn {
    min-width: 220px;
    flex: 1 1 240px;
    text-align: center;
}

/* end --- DRAWINGS */



.qr-page {
    padding: var(--app-base-unit);
    display: flex;
    justify-content: center;
}

.qr-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}

.qr-card {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 229, 226, 0.35);
    border-radius: 1rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    max-width: 480px;
    width: 100%;
    flex: 1 1 320px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.qr-image {
    width: 100%;
    max-width: 280px;
    align-self: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    background: #0d1117;
    padding: 0.75rem;
}

.qr-card-title {
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.qr-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.qr-url {
    font-family: "Consolas", "SFMono-Regular", Menlo, Monaco, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9rem;
    color: #00e5e2;
    word-break: break-all;
}

.qr-note {
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}



/* CUSTOM WALLPAPERS --- start */

.custom-wallpapers {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.custom-wallpapers-header {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.6fr);
    gap: 1rem;
    align-items: center;
}

.custom-wallpapers-meta {
    display: flex;
    flex-direction: column;
    align-items: start;
}

.custom-wallpapers .custom-wallpapers-title {
    font-size: 1rem;
    text-transform: uppercase;
}

.custom-wallpapers .custom-wallpapers-note {
    opacity: 0.75;
    font-size: 0.8rem;
    padding: 0.5rem 0.5rem;
    border-left: 3px solid #00E5E2;
    background: rgba(0, 229, 226, 0.08);
    border-radius: 0 0.25rem 0.25rem 0;
}

.custom-wallpapers .custom-wallpapers-storage {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.header-actions {
    display: flex;
    flex-direction: column;
    align-items: end;
    gap: 0.5rem;
}

.custom-wallpapers-upload input[type="file"],
.custom-wallpapers-upload input[type="file"]::-webkit-file-upload-button {
    display: none;
}

.custom-wallpapers-upload .upload-label {
    letter-spacing: 0.02em;
}

.badge {
    padding: 0.5rem 0.5rem;
    border-radius: 999px;
    background: rgba(0, 229, 226, 0.2);
    border: 1px solid rgba(0, 229, 226, 0.45);
    color: #0ff5f3;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    font-weight: 100;
}

.badge.on {
    background: rgba(0, 229, 226, 0.2);
    border: 1px solid rgba(0, 229, 226, 0.45);
    color: #0ff5f3;
}

.badge.off {
    border-color: rgba(227, 41, 64, 0.5);
    background: rgba(227, 41, 64, 0.2);
    color: #ffe1e7;
}

.custom-wallpapers-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.custom-wallpapers-empty {
    min-height: 250px;
    padding: 1.5rem;
    border: 1px dashed rgba(0, 229, 226, 0.4);
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.35);
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.empty-wallpaper-icon {
    width: 5rem;
    height: 5rem;
    border-radius: 0.5rem;
    border: 1px dashed rgba(0, 229, 226, 0.5);
    background: rgba(0, 229, 226, 0.05);
}

.custom-wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    width: 100%;
}

.custom-wallpaper-card {
    min-height: 260px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.custom-wallpaper-card:hover {
    border-color: #00e5e2;
    transform: translateY(-2px);
}

.custom-wallpaper-card.is-selected {
     border-color: #00E5E2;
}

.wallpaper-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.custom-wallpaper-thumb-wrapper {
    position: relative;
    width: 100%;
}

.custom-wallpaper-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    min-height: 220px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.custom-wallpaper-name {
    position: absolute;
    left: 0.5rem;
    bottom: 0.5rem;
    max-width: 90%;
    padding: 0.25rem;
    border-radius: 0.25rem;
    background: rgba(0, 0, 0, 0.65);
    overflow: hidden;
    color: #E4FFFF;
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-wallpaper-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.custom-wallpaper-select {
   font-weight: 300 !important;
}


/* ? */

.qr-target-picker {
    text-align: left;
}

.qr-target-picker label {
    display: block;
    margin-bottom: 0.35rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

.qr-hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-left: 0.75rem;
}

.custom-wallpaper-overlay {
    --footer-gap: 0px;
}

/* end --- CUSTOM WALLPAPERS */






/* === MEDIA === */

/* Mobile  */

@media (max-width: 699px) {

    /* BUTTONS */

    .btn {
        padding: 0.25rem 0.5rem;
    }

    .page-buttons {
        gap: 0.5rem;
    }

    .page-button {
        padding: 0.25rem 0.5rem;
    }

    /* PAGE */

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

    /* FOOTER */

    .footer {
        height: 8%;
    }

    .footer-center {
        top: 80%;
        left: 15%;
    }

    .footer-logo {
        height: 30%;
    }

    .footer-time {
        position: absolute;
        top: 60%;
        right: 5%;
        font-size: 0.75rem;
    }

    .footer-button, .footer-button.home-button {
        width: 5rem;
        align-items: start;
        justify-content: start;
    }

    .footer-button button {
        height: 50% !important;
    }

    /* SETTINGS PANEL */

    .settings-page {
        flex-direction: column;
        gap: 0.5rem;
        height: auto;
        overflow: visible;
    }

    .settings-container,
    .company-info {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .settings-item {
        gap: 0.5rem;
    }

    .theme-options, .settings-item .buttons-wrapper {
        gap: 0.5rem;
    }

    .theme-options {
        gap: 0.25rem;
    }

    .theme-option {
        width: 100%;
    }

    .media-container {
        gap: 1rem;
    }

    .media-qr {
        display: none;
    }

    .company-info-list {
        flex-direction: column;
        align-items: start;
        gap: 0;
    }

    .company-info-list ul {
        max-width: 100%;
        margin: 0;
    }

    /* DRAWINGS */

    .badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }

    /* CUSTOM WALLPAPER */

    .custom-wallpapers-header {
        display: flex;
        flex-direction: column;
        align-items: start;
    }

    .custom-wallpapers-meta {
        gap: 0.5rem;
    }

    .header-actions {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }

    .custom-wallpapers-empty {
        min-height: 200px;
    }

    .custom-wallpaper-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    /* PANEL TABS */

    .panel-tabs {
        gap: 0.5rem;
    }

    .panel-tabs-controls {
        gap: 0.5rem;
    }

    /* WIDGET PANEL */

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

    .reuse-content-grid.create-layout {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .widget-reuse-dialog .reuse-actions-column {
        width: 100%;
    }

    .widget-reuse-dialog .reuse-actions.with-quantity.vertical {
        display: flex;
        align-items: start;
        justify-content: start;
        gap: 1rem;
    }

    .reuse-quantity-inline {
        flex: 0;
    }

    .widget-reuse-dialog .reuse-preview-column, .widget-reuse-dialog .reuse-template-option, .widget-reuse-dialog .reuse-template-option .widget-template {
        width: 100% !important;
    }

    .reuse-content-grid.existing-layout {
        flex-direction: column-reverse;
        gap: 1rem;
    }

    .reuse-actions.existing-actions .reuse-actions-buttons {
        justify-content: start;
    }
}

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

@media (min-width: 700px) and (max-width: 880px) {

    /* PAGE */

    .page-title span {
        font-size: 1.25rem;
    }

    .page-title input.page-rename-input {
        font-size: 1.25rem;
    }

    /* FOOTER */

    .footer {
        height: 6%;
    }

    .footer-button, .footer-button.home-button {
        width: 5vh;
    }

    /* SETTINGS PANEL */

    .settings-page {
        flex-direction: column;
        gap: 0.5rem;
        height: auto;
        overflow: visible;
    }

    .settings-container,
    .company-info {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .theme-options, .settings-item .buttons-wrapper {
        gap: 0.5rem;
    }

    /* DRAWINGS */

    .badge {
        font-size: 0.65rem;
    }

    .drawings-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 300px));
    }

    /* CUSTOM WALLPAPERS */

    .custom-wallpapers-meta {
        gap: 0.5rem;
    }

    .custom-wallpapers .custom-wallpapers-title {
        font-size: 0.95rem;
    }

    .custom-wallpaper-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .custom-wallpapers .custom-wallpapers-note {
        font-size: 0.7rem;
    }

    /* WIDGET PANEL */

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

    .reuse-content-grid.create-layout {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .widget-reuse-dialog .reuse-actions-column {
        width: 100%;
    }

    .widget-reuse-dialog .reuse-actions.with-quantity.vertical {
        display: flex;
        align-items: start;
        justify-content: start;
        gap: 1rem;
    }

    .reuse-quantity-inline {
        flex: 0;
    }

    .widget-reuse-dialog .reuse-preview-column, .widget-reuse-dialog .reuse-template-option, .widget-reuse-dialog .reuse-template-option .widget-template {
        width: 100% !important;
    }

    .reuse-content-grid.existing-layout {
        flex-direction: column-reverse;
        gap: 1rem;
    }
}

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

@media (min-width: 881px) and (max-width: 1150px) {

    /* PAGE */

    .page-title span {
        font-size: 1.5rem;
    }

    .page-title input.page-rename-input {
        font-size: 1.5rem;
    }

    /* FOOTER */

    .footer-button, .footer-button.home-button {
        width: 8vh;
    }

    /* BUTTONS */

    .page-buttons {
        gap: 0.5rem;
    }

    .page-button {
        padding: 0 0.5rem;
        font-size: 0.85rem;
    }

    /* SETTINGS PANEL */

    .settings-page {
        flex-direction: column;
        gap: 1rem;
        height: auto;
        overflow: visible;
    }

    .settings-container,
    .company-info {
        height: auto; 
        min-height: 0;
        overflow: visible; 
    }

    .theme-options, .settings-item .buttons-wrapper {
        gap: 0.5rem;
    }

    /* DRAWINGS */

    .badge {
        font-size: 0.65rem;
    }

    .drawings-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 320px));
    }

    /* CUSTOM WALLPAPERS */

    .custom-wallpapers-meta {
        gap: 0.5rem;
    }

    .custom-wallpapers .custom-wallpapers-title {
        font-size: 0.95rem;
    }

    /* WIDGET PANEL */

    .widget-reuse-dialog .reuse-preview-column, .widget-reuse-dialog .reuse-template-option, .widget-reuse-dialog .reuse-template-option .widget-template {
        width: 100% !important;
    }

    .reuse-content-grid.existing-layout {
        flex-direction: column-reverse;
        gap: 1rem;
    }
}

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

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

    /* BUTTONS */

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    /* PAGE */

    .page-title {
        padding: 0.5rem 1rem;
    }

    .page-title span {
        font-size: 1.25rem;
    }

    .footer-time {
        font-size: 0.95rem;
    }

    /* PANEL TABS */

    .panel-tabs {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .panel-tab, .panel-tab-add, .panel-tab-disable, .panel-tab-reorder, .panel-tab-input {
        font-size: 0.85rem;
    }

    /* SETTINGS PANEL */

    .settings-page {
        gap: 1rem;
    }

    .settings-item {
        gap: 0.5rem;
    }

    .settings-item-label {
        font-size: 0.85rem;
    }

    .theme-options {
        gap: 0.5rem;
    }

    .theme-option {
        font-size: 1rem;
    }

    .description {
        font-size: 0.75rem;
    }

    .settings-item .buttons-wrapper {
        gap: 0.5rem;
    }

    .media-container {
        gap: 2rem;
    }

    .media-qr {
        width: 6rem;
        height: 6rem;
    }

    .media-icon {
        width: 0.8rem;
        height: 0.8rem;
    }

    .media-link {
        font-size: 0.85rem;
    }

    .company-info-list {
        align-items: start;
        gap: 1rem;
    }

    .company-info-list ul {
        font-size: 0.85rem;
    }

    /* EDIT CALIBRATION PANEL */

    .custom-select {
        font-size: 0.85rem;
    }

    /* DRAWINGS */

    .drawings-page-title .page-title-actions {
        padding: 0.5rem;
    }

    .drawings-title-caption {
        font-size: 0.75rem;
    }

    .badge {
        font-size: 0.65rem;
    }

    .drawing-name {
        font-size: 0.85rem;
    }

    /* CUSTOM WALLPAPER */

    .custom-wallpapers-meta {
        gap: 0.5rem;
    }

    .custom-wallpapers .custom-wallpapers-title {
        font-size: 0.85rem;
    }

    /* WIDGET PANEL */

    .widget-reuse-dialog .reuse-preview-column, .widget-reuse-dialog .reuse-template-option, .widget-reuse-dialog .reuse-template-option .widget-template {
        width: 100% !important;
    }

    .reuse-content-grid.existing-layout {
        flex-direction: column-reverse;
        gap: 1rem;
    }
}

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

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

    /* WIDGET PANEL */

    .widget-reuse-dialog .reuse-preview-column, .widget-reuse-dialog .reuse-template-option, .widget-reuse-dialog .reuse-template-option .widget-template {
        width: 100% !important;
    }
}

/* 4K (3840x2160) */

@media (min-width: 2880px) {

    /* BUTTONS */

    .btn {
        padding: 1rem 2rem;
        font-size: 2rem;
    }

    /* PAGE */

    .page-title {
        padding: 0.5rem 1rem;
    }

    .page-title span {
        font-size: 3rem;
    }

    .page-title input.page-rename-input {
        font-size: 3rem;
    }

    /* FOOTER */

    .footer-logo {
        height: 90%;
        width: 300px;
    }

    .footer-time {
        font-size: 2rem;
    }

    /* SETTINGS PANEL */

    .settings-container {
        padding: 2rem;
    }

    .settings-item {
        gap: 2rem;
    }

    .settings-item-label {
        font-size: 2.5rem;
    }

    .theme-options {
        gap: 1rem;
    }

    .theme-option {
        font-size: 2.5rem;
    }

    .theme-option label {
        padding: 1rem 2rem;
    }

    .theme-swatch {
        width: 6rem;
        height: 3rem;
    }

    .description {
        font-size: 1.75rem;
    }

    .media-qr {
        width: 16rem;
        height: 16rem;
    }

    .media-item {
        gap: 1rem;
    }

    .media-icon {
        width: 2rem;
        height: 2rem;
    }

    .media-link {
        font-size: 1.75rem;
    }

    .company-info-list ul {
        font-size: 1.75rem;
    }

    /* DRAWINGS */

    .drawings-page-title .page-title-main {
        padding: 0.5rem 1rem;
    }

    .drawings-page-title .page-title-actions {
        padding: 1rem;
    }

    .page-title-actions-content {
        gap: 1rem;
    }

    .drawings-title-caption {
        font-size: 1.75rem;
    }

    .badge {
        padding: 1rem;
        font-size: 1.75rem;
    }

    .drawings-grid {
        gap: 2rem;
        grid-template-columns: repeat(auto-fit, minmax(500px, 800px));
    }

    .drawing-name {
        font-size: 1.75rem;
    }

    .drawing-preview-actions {
        gap: 1rem;
    }

    .drawing-modal-label {
        font-size: 2rem;
        font-weight: 300;
    }

    .drawing-modal-hint {
        font-size: 1.75rem;
        line-height: 1.6;
    }

    .drawing-modal-body {
        gap: 1rem;
    }

    .drawing-modal-input {
        font-size: 1.75rem;
    }

    /* CUSTOM WALLPAPERS */

    .custom-wallpapers .custom-wallpapers-title {
        font-size: 2rem;
    }

    .header-actions {
        gap: 1rem;
    }

    .custom-wallpapers .custom-wallpapers-note {
        font-size: 1.5rem;
    }

    .custom-wallpapers-empty {
        min-height: 500px;
        gap: 4rem;
    }

    .empty-wallpaper-icon {
        width: 10rem;
        height: 10rem;
    }

    .custom-wallpaper-select {
        font-size: 1.75rem;
    }

    /* ALARM MANAGEMENT */

    .mute-icon {
        font-size: 2rem;
    }

    /* PANEL TABS */

    .panel-tabs {
        padding: 1rem;
        gap: 1rem;
    }

    .panel-tab {
        padding: 0.5rem 1rem;
        font-size: 2rem;
    }

    .panel-tab span {
        font-size: 2rem;
    }

    .panel-tab-input {
        font-size: 2rem;
    }

    .panel-tabs-controls {
        gap: 1rem;
    }

    .panel-tab-add, .panel-tab-reorder, .panel-tab-disable {
        padding: 0.5rem 1rem;
        font-size: 2rem;
    }

    /* WIDGET CREATOR PANEL */

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

    .reuse-quantity-inline {
        gap: 1rem;
    }

    .reuse-quantity-inline label {
        font-size: 2rem;
    }

    .reuse-actions-buttons {
        gap: 1rem;
    }

    /* WIDGET PANEL */

    .widget-reuse-dialog .reuse-preview-column, .widget-reuse-dialog .reuse-template-option, .widget-reuse-dialog .reuse-template-option .widget-template {
        width: 100% !important;
    }
}

/* Low height */

@media (min-width: 1000px) and (max-height: 650px) {
    /* CUSTOM WAllPAPER */

    .custom-wallpaper-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* WIDGET PANEL */

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

    .reuse-content-grid.create-layout {
        display: flex;
        flex-direction: column-reverse;
        gap: 1rem;
    }

    .widget-reuse-dialog .reuse-actions-column {
        width: 100%;
    }

    .widget-reuse-dialog .reuse-actions.with-quantity.vertical {
        display: flex;
        align-items: start;
        justify-content: start;
        gap: 1rem;
    }

    .reuse-quantity-inline {
        flex: 0;
    }

    .widget-reuse-dialog .reuse-preview-column, .widget-reuse-dialog .reuse-template-option, .widget-reuse-dialog .reuse-template-option .widget-template {
        width: 100% !important;
    }

    .reuse-content-grid.existing-layout {
        flex-direction: column-reverse;
        gap: 1rem;
    }

    .reuse-actions.existing-actions .reuse-actions-buttons {
        justify-content: start;
    }

    .widget-reuse-dialog .reuse-template-option .widget-template {
        height: auto;
    }

    .widget-reuse-dialog .reuse-actions.with-quantity.vertical {
        width: 100%;
        flex-direction: row;
        align-items: end;
        justify-content: space-between;
    }
}

/* Override for 1024x600 */

@media (width: 1024px) and (height: 600px) {

    /* CUSTOM WAllPAPER */

    .custom-wallpaper-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* WIDGET PANEL */

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

    .reuse-content-grid.create-layout {
        display: flex;
        flex-direction: column-reverse;
        gap: 1rem;
    }

    .widget-reuse-dialog .reuse-actions-column {
        width: 100%;
    }

    .custom-wallpaper-actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

/*    .custom-wallpaper-select {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        font-weight: 600;
    }*/

    .widget-reuse-dialog .reuse-actions.with-quantity.vertical {
        display: flex;
        align-items: start;
        justify-content: start;
        gap: 1rem;
    }

    .reuse-quantity-inline {
        flex: 0;
    }

    .widget-reuse-dialog .reuse-preview-column, .widget-reuse-dialog .reuse-template-option, .widget-reuse-dialog .reuse-template-option .widget-template {
        width: 100% !important;
    }

    .reuse-content-grid.existing-layout {
        flex-direction: column-reverse;
        gap: 1rem;
    }

    .reuse-actions.existing-actions .reuse-actions-buttons {
        justify-content: start;
    }

    .widget-reuse-dialog .reuse-template-option .widget-template {
        height: auto;
    }

    .widget-reuse-dialog .reuse-actions.with-quantity.vertical {
        width: 100%;
        flex-direction: row;
        align-items: end;
        justify-content: space-between;
    }
}


@media (max-width: 1100px) {
    .scheduler-page {
        grid-template-columns: 1fr;
    }
}

/* Scheduler */

.scheduler-page {
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 1.4);
    width: 100%;
    padding: calc(var(--app-base-unit) * 0.6) calc(var(--app-base-unit) * 0.4);
    align-items: stretch;
/*    height: calc(var(--app-safe-height) - var(--footer-height, 0px) - var(--page-title-measured, 64px));*/
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
}

.scheduler-title {
    display: flex;
    align-items: center;
    gap: calc(var(--app-base-unit) * 0.6);
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: hidden;
    padding: 0.25rem 0.5rem;
    text-overflow: ellipsis;
    margin-left: 1%;
}

.scheduler-scope {
    font-size: calc(var(--app-base-unit) * 0.9);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    color: rgba(255, 255, 255, 0.7);
}

.scheduler-loading {
    background: linear-gradient(155deg, rgba(8, 13, 23, 0.9), rgba(9, 20, 30, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: calc(var(--app-base-unit) * 0.6);
    padding: calc(var(--app-base-unit) * 2);
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 0.9);
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px) saturate(115%);
    position: relative;
    overflow: hidden;
}

    .scheduler-loading::before {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(circle at 30% 25%, rgba(0, 229, 226, 0.16), transparent 42%), radial-gradient(circle at 75% 10%, rgba(255, 255, 255, 0.08), transparent 40%);
        pointer-events: none;
    }

.scheduler-loading-spinner {
    width: calc(var(--app-base-unit) * 2.6);
    height: calc(var(--app-base-unit) * 2.6);
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #00e5e2;
    animation: scheduler-spin 0.9s linear infinite;
    z-index: 1;
}

.scheduler-loading-text {
    font-size: calc(var(--app-base-unit) * 1.05);
    font-weight: 600;
    letter-spacing: 0.02em;
    z-index: 1;
}

@keyframes scheduler-spin {
    to {
        transform: rotate(360deg);
    }
}

.scheduler-config {
    background: linear-gradient(160deg, rgba(10, 14, 22, 0.92), rgba(12, 24, 34, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: calc(var(--app-base-unit) * 0.6);
    padding: calc(var(--app-base-unit) * 1.35);
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 0.9);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.32), 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px) saturate(115%);
    position: relative;
    overflow: hidden;
}

    .scheduler-config::before {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(circle at 20% 20%, rgba(0, 229, 226, 0.12), transparent 38%), radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.06), transparent 36%);
        pointer-events: none;
    }

    .scheduler-config h2 {
        margin: 0;
        font-size: calc(var(--app-base-unit) * 1.3);
        letter-spacing: 0.08em;
        color: #f7fdff;
        text-transform: uppercase;
    }

    .scheduler-config label {
        font-weight: 700;
        font-size: calc(var(--app-base-unit) * 0.98);
        color: rgba(255, 255, 255, 0.92);
        letter-spacing: 0.02em;
    }

    .scheduler-config select {
        padding: calc(var(--app-base-unit) * 0.65) calc(var(--app-base-unit) * 0.9);
        border-radius: calc(var(--app-base-unit) * 0.5);
        border: 1px solid rgba(0, 229, 226, 0.45);
        background: linear-gradient(135deg, rgba(14, 30, 45, 0.96), rgba(10, 26, 38, 0.9));
        color: #e9f9ff;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 18px rgba(0, 0, 0, 0.22);
    }

        .scheduler-config select option {
            background-color: #0e1c2a;
            color: #e9f9ff;
        }

    .scheduler-config .config-hint {
        margin: 0;
        font-size: calc(var(--app-base-unit) * 0.9);
        color: rgba(255, 255, 255, 0.8);
    }

.scheduler-calendar {
    background: linear-gradient(155deg, rgba(8, 13, 23, 0.9), rgba(9, 20, 30, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: calc(var(--app-base-unit) * 0.6);
    padding: calc(var(--app-base-unit) * 1.2);
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 1.2);
    flex: 1;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px) saturate(115%);
    position: relative;
    overflow: auto;
    max-height: none;
    min-height: 0;
}

    .scheduler-calendar.full-width {
        width: 100%;
        min-height: auto;
    }

.calendar-content {
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 0.8);
    flex: 1;
    min-height: 0;
}

.scheduler-calendar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 25%, rgba(0, 229, 226, 0.16), transparent 42%), radial-gradient(circle at 75% 10%, rgba(255, 255, 255, 0.08), transparent 40%), radial-gradient(circle at 85% 75%, rgba(0, 229, 226, 0.08), transparent 38%);
    pointer-events: none;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: calc(var(--app-base-unit) * 1.1);
    flex-wrap: wrap;
}

    .calendar-header .calendar-nav {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        justify-items: center;
        column-gap: calc(var(--app-base-unit) * 1.1);
        width: clamp(260px, 28vw, 360px);
        padding: 0;
        border-radius: 0;
        background: none;
        border: none;
        box-shadow: none;
    }

        .calendar-header .calendar-nav .nav-button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: calc(var(--app-base-unit) * 2.2);
            height: calc(var(--app-base-unit) * 2.2);
            border-radius: 50%;
            border: 1px solid rgba(0, 229, 226, 0.5);
            background: radial-gradient(circle at 30% 30%, rgba(0, 229, 226, 0.36), rgba(0, 229, 226, 0.12));
            color: #e7fbff;
            font-size: calc(var(--app-base-unit) * 1.15);
            cursor: pointer;
            transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
        }

            .calendar-header .calendar-nav .nav-button:hover {
                transform: translateY(-2px);
                box-shadow: 0 8px 18px rgba(0, 229, 226, 0.18);
                border-color: rgba(0, 229, 226, 0.7);
            }

            .calendar-header .calendar-nav .nav-button:active {
                transform: translateY(0);
                box-shadow: none;
            }

    .calendar-header .month-label {
        font-size: calc(var(--app-base-unit) * 1.2);
        font-weight: 700;
        letter-spacing: 0.08em;
        text-align: center;
        white-space: nowrap;
    }


.calendar-range-picker {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: calc(var(--app-base-unit) * 0.6);
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.scheduler-close-button {
    padding: calc(var(--app-base-unit) * 0.5) calc(var(--app-base-unit) * 1.1);
    font-weight: 600;
}

.scheduler-widget {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.scheduler-last-execution,
.scheduler-next-execution {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.4rem 0.55rem;
    border-radius: calc(var(--app-base-unit) * 0.45);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(0, 229, 226, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}


.scheduler-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 1.3rem;
}

.scheduler-last-label,
.scheduler-next-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    line-height: 1.2;
}

.scheduler-last-name,
.scheduler-next-name {
    font-weight: 700;
    color: #f4feff;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.scheduler-last-time,
.scheduler-next-time {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.2;
}

.calendar-range-picker .range-row {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--app-base-unit) * 0.9);
}

.calendar-range-picker .range-title {
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #e6fbff;
    font-size: calc(var(--app-base-unit) * 0.95);
}

.calendar-range-picker select {
    padding: calc(var(--app-base-unit) * 0.55) calc(var(--app-base-unit) * 0.9);
    border-radius: calc(var(--app-base-unit) * 0.45);
    border: 1px solid rgba(0, 229, 226, 0.45);
    background: rgba(10, 26, 38, 0.9);
    color: #e9f9ff;
    min-width: 160px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

    .calendar-range-picker select option {
        background-color: #0e1c2a;
        color: #e9f9ff;
    }

.calendar-range-toggles {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--app-base-unit) * 0.4);
}

.calendar-range-toggle {
    padding: calc(var(--app-base-unit) * 0.45) calc(var(--app-base-unit) * 0.85);
    border-radius: calc(var(--app-base-unit) * 0.4);
    border: 1px solid rgba(0, 229, 226, 0.45);
    background: rgba(10, 26, 38, 0.7);
    color: #e9f9ff;
    font-size: calc(var(--app-base-unit) * 0.85);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

    .calendar-range-toggle:hover {
        border-color: rgba(0, 229, 226, 0.7);
        background: rgba(0, 229, 226, 0.15);
        color: #e7fbff;
    }

    .calendar-range-toggle.is-active {
        border-color: rgba(0, 229, 226, 0.9);
        background: rgba(0, 229, 226, 0.25);
        color: #ffffff;
        box-shadow: 0 6px 16px rgba(0, 229, 226, 0.15);
    }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: calc(var(--app-base-unit) * 1);
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: calc(var(--app-base-unit) * 1);
    margin-bottom: calc(var(--app-base-unit) * 0.5);
    padding: 0 calc(var(--app-base-unit) * 0.2);
}

    .calendar-weekdays .weekday {
        text-align: center;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.82);
        font-size: calc(var(--app-base-unit) * 0.9);
        padding: calc(var(--app-base-unit) * 0.35) 0;
        background: rgba(255, 255, 255, 0.04);
        border-radius: calc(var(--app-base-unit) * 0.45);
        border: 1px solid rgba(255, 255, 255, 0.06);
        box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    }

.calendar-grid.range-week,
.calendar-grid.range-two-weeks,
.calendar-grid.range-four-weeks {
    grid-auto-rows: minmax(0, 1fr);
    align-content: stretch;
    height: 100%;
}

    .calendar-grid.range-week .calendar-day,
    .calendar-grid.range-two-weeks .calendar-day,
    .calendar-grid.range-four-weeks .calendar-day {
        height: 100%;
    }

.calendar-day {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: calc(var(--app-base-unit) * 0.55);
    padding: calc(var(--app-base-unit) * 0.75);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(0, 229, 226, 0.04));
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 0.35);
    min-height: 108px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.24s ease, border-color 0.24s ease, background 0.24s ease;
    position: relative;
    overflow: hidden;
}

    .calendar-day::before {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(circle at 20% 20%, rgba(0, 229, 226, 0.12), transparent 40%);
        opacity: 0;
        transition: opacity 0.18s ease;
    }

    .calendar-day:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
        border-color: rgba(0, 229, 226, 0.5);
        background: linear-gradient(145deg, rgba(0, 229, 226, 0.07), rgba(255, 255, 255, 0.05));
    }

        .calendar-day:hover::before {
            opacity: 1;
        }

    .calendar-day.past-day {
        opacity: 0.78;
        filter: grayscale(0.18);
        border-color: rgba(255, 255, 255, 0.06);
        background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.2));
        box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

        .calendar-day.past-day .day-number,
        .calendar-day.past-day .day-name,
        .calendar-day.past-day .day-date {
            color: rgba(255, 255, 255, 0.7);
        }

    .calendar-day .day-name {
        font-weight: 700;
        color: rgba(255, 255, 255, 0.8);
        text-transform: uppercase;
        font-size: calc(var(--app-base-unit) * 0.9);
    }

    .calendar-day .day-number {
        font-size: calc(var(--app-base-unit) * 1.6);
        font-weight: 800;
    }

    .calendar-day .day-date {
        color: rgba(255, 255, 255, 0.72);
        font-size: calc(var(--app-base-unit) * 0.78);
        padding: 0.1rem 0.45rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.06);
        display: inline-flex;
        align-items: center;
        width: fit-content;
    }

.routine-config-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(0, 229, 226, 0.12), rgba(0, 0, 0, 0.8));
    backdrop-filter: blur(10px) saturate(110%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--app-base-unit) * 1.2);
    z-index: 1000;
}

.routine-config-card {
    width: min(700px, 94vw);
    max-height: min(86vh, 820px);
    background: linear-gradient(165deg, rgba(6, 12, 22, 0.95), rgba(9, 26, 36, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: calc(var(--app-base-unit) * 0.65);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    overflow: visible;
    position: relative;
    z-index: 2;
    transform: translateY(-1.5vh);
}

.routine-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--app-base-unit) * 1.2);
    padding: calc(var(--app-base-unit) * 1.2) calc(var(--app-base-unit) * 1.4);
    background: linear-gradient(120deg, rgba(0, 229, 226, 0.08), rgba(255, 255, 255, 0.04));
    border-bottom: 1px solid rgba(0, 229, 226, 0.25);
}

.routine-config-title {
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 0.35);
}

.routine-config-label {
    font-size: calc(var(--app-base-unit) * 1.15);
    letter-spacing: 0.08em;
    color: #e7fbff;
    font-weight: 700;
}

.routine-config-date {
    color: rgba(255, 255, 255, 0.85);
    font-size: calc(var(--app-base-unit) * 0.95);
}

.routine-config-close {
    border: 1px solid rgba(0, 229, 226, 0.4);
    background: radial-gradient(circle at 30% 30%, rgba(0, 229, 226, 0.32), rgba(0, 229, 226, 0.12));
    color: #e7fbff;
    width: calc(var(--app-base-unit) * 2.4);
    height: calc(var(--app-base-unit) * 2.4);
    border-radius: 50%;
    font-size: calc(var(--app-base-unit) * 1.2);
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0, 229, 226, 0.18);
}

.routine-config-body {
    padding: calc(var(--app-base-unit) * 1.3) calc(var(--app-base-unit) * 1.4);
    color: rgba(255, 255, 255, 0.9);
    font-size: calc(var(--app-base-unit) * 0.98);
    min-height: 160px;
    flex: 1 1 auto;
    overflow-y: auto;
}

.routine-config-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: calc(var(--app-base-unit) * 1.1);
}

.routine-day-panel {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.02), rgba(0, 229, 226, 0.05));
    border: 1px solid rgba(0, 229, 226, 0.25);
    border-radius: calc(var(--app-base-unit) * 0.5);
    padding: calc(var(--app-base-unit) * 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 26px rgba(0, 0, 0, 0.32);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-height: 100%;
}

.routine-day-header {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.day-panel-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.routine-day-title {
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #e6fbff;
    font-size: calc(var(--app-base-unit) * 1);
}

.routine-day-date {
    color: rgba(255, 255, 255, 0.75);
    font-size: calc(var(--app-base-unit) * 0.9);
}

.routine-day-empty {
    padding: 0.6rem 0.5rem;
    border: 1px dashed rgba(0, 229, 226, 0.32);
    border-radius: calc(var(--app-base-unit) * 0.4);
    color: rgba(255, 255, 255, 0.78);
    background: rgba(255, 255, 255, 0.02);
}

.routine-delete-overlay .widget-dialog-panel {
    max-width: 360px;
    width: 100%;
}

.routine-delete-panel {
    padding: calc(var(--app-base-unit) * 0.8);
}

    .routine-delete-panel p {
        margin: 0 0 calc(var(--app-base-unit) * 0.8);
        color: rgba(255, 255, 255, 0.8);
        font-size: calc(var(--app-base-unit) * 0.85);
    }

.routine-delete-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

    .routine-delete-actions .btn {
        flex: 1 1 30%;
        min-width: 140px;
        padding: 0.4rem 0.6rem;
    }

.routine-day-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.35rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 229, 226, 0.45) transparent;
}

    .routine-day-list::-webkit-scrollbar {
        width: 6px;
    }

    .routine-day-list::-webkit-scrollbar-track {
        background: transparent;
    }

    .routine-day-list::-webkit-scrollbar-thumb {
        background: rgba(0, 229, 226, 0.35);
        border-radius: 999px;
    }

        .routine-day-list::-webkit-scrollbar-thumb:hover {
            background: rgba(0, 229, 226, 0.55);
        }


.routine-day-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: stretch;
    gap: 0.45rem;
}

.routine-day-item {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    padding: 0.55rem 0.6rem;
    border-radius: calc(var(--app-base-unit) * 0.4);
    border: 1px solid rgba(0, 229, 226, 0.3);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    text-align: left;
    width: 100%;
    border: 1px solid rgba(0, 229, 226, 0.28);
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
    appearance: none;
    color: inherit;
    font: inherit;
}

.routine-day-delete {
    border-radius: calc(var(--app-base-unit) * 0.4);
    border: 1px solid rgba(255, 94, 94, 0.6);
    background: linear-gradient(145deg, rgba(255, 94, 94, 0.14), rgba(255, 94, 94, 0.04));
    color: #ffd9d9;
    font-weight: 700;
    padding: 0.55rem 0.6rem;
    min-width: 0;
    cursor: pointer;
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, color 120ms ease;
    height: 100%;
}

    .routine-day-delete:hover {
        transform: translateY(-1px);
        border-color: rgba(255, 94, 94, 0.9);
        background: linear-gradient(145deg, rgba(255, 94, 94, 0.22), rgba(255, 94, 94, 0.08));
        color: #fff1f1;
    }

    .routine-day-delete:focus-visible {
        outline: 2px solid rgba(255, 94, 94, 0.8);
        outline-offset: 1px;
    }

.routine-day-item:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 229, 226, 0.6);
    background: rgba(0, 229, 226, 0.08);
}

.routine-day-item:focus-visible {
    outline: 2px solid rgba(0, 229, 226, 0.8);
    outline-offset: 1px;
}

.routine-day-name {
    font-weight: 700;
    color: rgba(244, 254, 255, 0.95);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: calc(var(--app-base-unit) * 0.98);
    letter-spacing: 0.02em;
}

.routine-day-time {
    font-weight: 600;
    color: rgba(231, 251, 255, 0.88);
    letter-spacing: 0.02em;
    font-size: calc(var(--app-base-unit) * 0.93);
}

.routine-day-frequency {
    color: rgba(255, 255, 255, 0.62);
    font-size: calc(var(--app-base-unit) * 0.86);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.routine-config-main {
    background: rgba(255, 255, 255, 0.02);
    border-radius: calc(var(--app-base-unit) * 0.5);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: calc(var(--app-base-unit) * 0.2);
}

.routine-type-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: calc(var(--app-base-unit) * 0.9);
}

.routine-type-card {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: calc(var(--app-base-unit) * 0.4);
    align-items: start;
    padding: calc(var(--app-base-unit) * 1);
    border-radius: calc(var(--app-base-unit) * 0.6);
    border: 1px solid rgba(0, 229, 226, 0.4);
    background: linear-gradient(150deg, rgba(0, 229, 226, 0.12), rgba(255, 255, 255, 0.04));
    color: #f4feff;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

    .routine-type-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 18px 36px rgba(0, 0, 0, 0.38);
        border-color: rgba(0, 229, 226, 0.65);
    }

.routine-type-icon {
    width: calc(var(--app-base-unit) * 3);
    height: calc(var(--app-base-unit) * 3);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--app-base-unit) * 1.6);
    background: radial-gradient(circle at 30% 30%, rgba(0, 229, 226, 0.3), rgba(0, 229, 226, 0.1));
    border: 1px solid rgba(0, 229, 226, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.routine-type-name {
    font-weight: 700;
    font-size: calc(var(--app-base-unit) * 1.05);
    color: #f4feff;
}

.routine-type-description {
    margin-top: 0.15rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: calc(var(--app-base-unit) * 0.95);
}

.routine-form {
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 0.7);
}

.routine-config-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}


.favorite-add-button,
.favorite-toggle,
.day-panel-toggle {
    padding: 0.45rem 0.75rem;
    border-radius: calc(var(--app-base-unit) * 0.35);
    border: 1px solid rgba(0, 229, 226, 0.45);
    background: linear-gradient(145deg, rgba(0, 229, 226, 0.28), rgba(0, 229, 226, 0.12));
    color: #e7fbff;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.3);
}

    .favorite-add-button:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        box-shadow: none;
    }

.favorite-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(145deg, rgba(0, 229, 226, 0.16), rgba(0, 229, 226, 0.08));
}

.day-panel-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(0, 229, 226, 0.1));
}

.favorite-toggle .chevron {
    font-size: 1.1rem;
    opacity: 0.8;
}

.day-panel-toggle .chevron {
    font-size: 1.1rem;
    opacity: 0.8;
}

.favorite-add-button:hover:not(:disabled),
.favorite-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 229, 226, 0.65);
    box-shadow: 0 14px 22px rgba(0, 0, 0, 0.35);
}

.favorites-panel {
    position: absolute;
    top: 0;
    left: 100%;
    width: 360px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 0.75rem;
    background: linear-gradient(160deg, rgba(6, 20, 28, 0.92), rgba(3, 11, 17, 0.94));
    border-left: 1px solid rgba(0, 229, 226, 0.25);
    box-shadow: -18px 0 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    transition: transform 0.22s ease, opacity 0.2s ease;
    z-index: 1;
    pointer-events: none;
    transform: translateX(-100%);
    opacity: 0;
}

    .favorites-panel.open {
        pointer-events: auto;
        transform: translateX(12px);
        opacity: 1;
    }

.day-routines-panel {
    position: absolute;
    top: 0;
    right: calc(100% + 12px);
    width: 320px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 0.75rem;
    background: linear-gradient(160deg, rgba(6, 20, 28, 0.92), rgba(3, 11, 17, 0.94));
    border-right: 1px solid rgba(0, 229, 226, 0.25);
    box-shadow: 18px 0 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    transition: transform 0.22s ease, opacity 0.2s ease;
    z-index: 10;
    pointer-events: none;
    transform: translateX(-115%);
    opacity: 0;
}

    .day-routines-panel.open {
        pointer-events: auto;
        transform: translateX(0);
        opacity: 1;
    }

.day-panel-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.day-panel-title {
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #e6fbff;
    font-size: calc(var(--app-base-unit) * 1);
}

.day-panel-date {
    color: rgba(255, 255, 255, 0.75);
    font-size: calc(var(--app-base-unit) * 0.9);
}

.favorites-panel-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.favorites-panel-title {
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #f4feff;
}

.favorites-search {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border-radius: calc(var(--app-base-unit) * 0.35);
    border: 1px solid rgba(0, 229, 226, 0.32);
    background: rgba(255, 255, 255, 0.04);
    color: #e7fbff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.favorites-panel-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.favorite-panel-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: stretch;
    gap: 0.4rem;
}

.favorite-panel-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    padding: 0.55rem 0.65rem;
    border-radius: calc(var(--app-base-unit) * 0.35);
    border: 1px solid rgba(0, 229, 226, 0.28);
    background: rgba(255, 255, 255, 0.04);
    color: #f4feff;
    cursor: pointer;
    text-align: left;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

    .favorite-panel-item:hover {
        transform: translateY(-1px);
        border-color: rgba(0, 229, 226, 0.5);
        box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28);
    }

.favorite-panel-delete {
    border: 1px solid rgba(0, 229, 226, 0.28);
    background: rgba(255, 255, 255, 0.04);
    color: #f4feff;
    border-radius: calc(var(--app-base-unit) * 0.35);
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

    .favorite-panel-delete:hover {
        transform: translateY(-1px);
        border-color: rgba(255, 82, 82, 0.65);
        background: rgba(255, 82, 82, 0.08);
        box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28);
    }

.favorite-panel-name {
    font-weight: 700;
}

.favorite-panel-meta {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
}

.favorites-panel-empty {
    padding: 0.5rem 0.6rem;
    border: 1px dashed rgba(0, 229, 226, 0.32);
    border-radius: calc(var(--app-base-unit) * 0.35);
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.02);
}

.routine-form-header h3 {
    margin: 0 0 0.3rem;
    font-size: calc(var(--app-base-unit) * 1.15);
    color: #f4feff;
}

.routine-form-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
}

.routine-form-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: calc(var(--app-base-unit) * 0.75) calc(var(--app-base-unit) * 0.8);
}

.routine-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.35rem 0.4rem 0.45rem;
    background: transparent;
    border: none;
    box-shadow: none;
}

    .routine-form-group label {
        font-weight: 700;
        color: #f4feff;
        letter-spacing: 0.02em;
    }

.interval-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

    .interval-input-row input,
    .interval-input-row select {
        flex: 1 1 120px;
    }

.routine-form-group select {
    background: #0d1c28;
    border: 1px solid rgba(0, 229, 226, 0.38);
    color: #e7fbff;
    padding: 0.48rem 0.7rem;
    border-radius: calc(var(--app-base-unit) * 0.4);
    font-size: calc(var(--app-base-unit) * 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

    .routine-form-group select option,
    .routine-form-group select:focus option,
    .routine-form-group select:active option {
        background-color: #0d1c28;
        color: #e7fbff;
    }

.routine-form-group input[type="text"],
.routine-form-group input[type="time"],
.routine-form-group input:not([type]) {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(0, 229, 226, 0.38);
    color: #e7fbff;
    padding: 0.48rem 0.7rem;
    border-radius: calc(var(--app-base-unit) * 0.4);
    font-size: calc(var(--app-base-unit) * 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.routine-field-hint {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: calc(var(--app-base-unit) * 0.9);
}

.routine-form-placeholder {
    border: 1px dashed rgba(0, 229, 226, 0.28);
    border-radius: calc(var(--app-base-unit) * 0.55);
    padding: calc(var(--app-base-unit) * 0.85);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(0, 229, 226, 0.05));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    margin-top: 0.2rem;
}

    .routine-form-placeholder h3 {
        margin: 0 0 0.35rem;
        font-size: calc(var(--app-base-unit) * 1.2);
        color: #f4feff;
    }

    .routine-form-placeholder p {
        margin: 0;
        color: rgba(255, 255, 255, 0.85);
    }

.routine-signal-section {
    margin-top: calc(var(--app-base-unit) * 0.6);
    border: 1px solid rgba(0, 229, 226, 0.2);
    border-radius: calc(var(--app-base-unit) * 0.55);
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.03), rgba(0, 229, 226, 0.06));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    padding: calc(var(--app-base-unit) * 0.8);
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 0.7);
}

    .routine-signal-section.signals-disabled {
        opacity: 0.7;
    }

.routine-signal-header h4 {
    margin: 0;
    color: #f4feff;
    letter-spacing: 0.06em;
}

.routine-signal-header p {
    margin: 0.2rem 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: calc(var(--app-base-unit) * 0.92);
}

.signal-disconnected {
    margin-left: auto;
    background: rgba(255, 115, 0, 0.18);
    border: 1px solid rgba(255, 153, 0, 0.4);
    color: #ffd7a3;
    padding: 0.35rem 0.65rem;
    border-radius: calc(var(--app-base-unit) * 0.45);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    font-weight: 700;
}

.routine-signal-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: calc(var(--app-base-unit) * 0.6);
}

.routine-signal-list,
.routine-signal-selected {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(0, 229, 226, 0.24);
    border-radius: calc(var(--app-base-unit) * 0.45);
    padding: calc(var(--app-base-unit) * 0.75);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 0.5);
}

    .routine-signal-list .panel-title,
    .routine-signal-selected .panel-title {
        font-weight: 700;
        color: rgba(255, 255, 255, 0.9);
        letter-spacing: 0.04em;
    }

.signal-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
    max-height: 200px;
    overflow-y: auto;
}

.signal-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.45rem 0.55rem;
    border-radius: calc(var(--app-base-unit) * 0.35);
    border: 1px solid transparent;
}

    .signal-option input[type="checkbox"] {
        accent-color: #00e5e2;
    }

    .signal-option:hover {
        border-color: rgba(0, 229, 226, 0.4);
        background: rgba(255, 255, 255, 0.06);
    }

.signal-name {
    font-weight: 700;
    color: #f4feff;
}

.signal-id {
    grid-column: 2;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.82rem;
}

.signal-empty {
    padding: 0.6rem;
    border: 1px dashed rgba(0, 229, 226, 0.35);
    border-radius: calc(var(--app-base-unit) * 0.4);
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
}

.signal-offline-notice {
    padding: 0.75rem 0.9rem;
    border-radius: calc(var(--app-base-unit) * 0.45);
    background: linear-gradient(120deg, rgba(255, 99, 71, 0.18), rgba(255, 182, 80, 0.16));
    border: 1px solid rgba(255, 153, 0, 0.36);
    color: #ffe9c7;
    text-align: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.selected-signal-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.selected-signal-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.45rem 0.55rem;
    border-radius: calc(var(--app-base-unit) * 0.35);
    border: 1px solid rgba(0, 229, 226, 0.2);
}

.selected-signal-label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    width: 100%;
    text-align: left;
}

    .selected-signal-label .label-name {
        color: #f4feff;
        font-weight: 700;
        font-size: 0.95rem;
    }

    .selected-signal-label .label-id {
        color: rgba(255, 255, 255, 0.68);
        font-size: 0.85rem;
    }

.signal-state {
    background: #0d1c28;
    color: #e7fbff;
    border-radius: calc(var(--app-base-unit) * 0.35);
    border: 1px solid rgba(0, 229, 226, 0.38);
    padding: 0.3rem 0.5rem;
    min-width: 95px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.signal-state-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
}

.signal-mode-select {
    background: #0d1c28;
    color: #e7fbff;
    border-radius: calc(var(--app-base-unit) * 0.35);
    border: 1px solid rgba(0, 229, 226, 0.38);
    padding: 0.3rem 0.5rem;
    min-width: 130px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.selected-signal-row .signal-mode-select {
    font-size: 0.9rem;
}

.signal-mode-select option,
.signal-mode-select:focus option,
.signal-mode-select:active option,
.signal-state option,
.signal-state:focus option,
.signal-state:active option {
    background-color: #0d1c28;
    color: #e7fbff;
}

.signal-action-button {
    background: rgba(0, 229, 226, 0.12);
    color: #e7fbff;
    border-radius: calc(var(--app-base-unit) * 0.35);
    border: 1px solid rgba(0, 229, 226, 0.4);
    padding: 0.25rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
}

    .signal-action-button:hover {
        border-color: rgba(0, 229, 226, 0.7);
    }

.signal-action-row {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    width: 100%;
}

.widget-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    width: 100%;
}

    .widget-action-row .widget-action-name {
        flex: 1 1 auto;
        min-width: 0;
        white-space: normal;
        word-break: keep-all;
        overflow-wrap: normal;
    }

    .widget-action-row .widget-action-count {
        flex: 0 0 auto;
        margin-left: auto;
        text-align: right;
    }

.signal-percentage {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: #e7fbff;
    flex: 0 0 auto;
}

    .signal-percentage input[type="number"] {
        width: 72px;
        padding: 0.25rem 0.35rem;
        border-radius: calc(var(--app-base-unit) * 0.3);
        border: 1px solid rgba(0, 229, 226, 0.35);
        background: rgba(0, 0, 0, 0.2);
        color: #e7fbff;
    }

    .signal-percentage .percentage-label {
        min-width: 36px;
        text-align: right;
        font-weight: 700;
        letter-spacing: 0.02em;
    }

.routine-signal-tag {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 0.04rem 0.32rem;
    color: #f4feff;
    font-size: 0.64rem;
    display: inline-flex;
    gap: 0.18rem;
    align-items: center;
}

    .routine-signal-tag .signal-state {
        border: none;
        background: transparent;
        color: #00e5e2;
        padding: 0;
        min-width: 0;
        box-shadow: none;
    }

.routine-config-footer {
    padding: calc(var(--app-base-unit) * 1.2) calc(var(--app-base-unit) * 1.4);
    border-top: 1px solid rgba(0, 229, 226, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: calc(var(--app-base-unit) * 0.8);
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.04), rgba(0, 229, 226, 0.06));
}

.routine-config-dismiss {
    padding: calc(var(--app-base-unit) * 0.8) calc(var(--app-base-unit) * 1.6);
    border-radius: calc(var(--app-base-unit) * 0.5);
    border: 1px solid rgba(0, 229, 226, 0.4);
    background: linear-gradient(145deg, rgba(0, 229, 226, 0.3), rgba(0, 229, 226, 0.12));
    color: #e7fbff;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
}

.routine-config-submit {
    padding: calc(var(--app-base-unit) * 0.8) calc(var(--app-base-unit) * 1.6);
    border-radius: calc(var(--app-base-unit) * 0.5);
    border: 1px solid rgba(0, 229, 226, 0.6);
    background: linear-gradient(145deg, rgba(0, 229, 226, 0.45), rgba(0, 229, 226, 0.18));
    color: #001a1a;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 26px rgba(0, 229, 226, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

    .routine-config-submit:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        box-shadow: none;
    }

    .routine-config-submit:not(:disabled):hover {
        transform: translateY(-1px);
        box-shadow: 0 16px 32px rgba(0, 229, 226, 0.32);
        border-color: rgba(0, 229, 226, 0.8);
    }

.routine-preview-overlay {
    position: fixed;
    inset: var(--page-title-measured, 64px) 0 calc(var(--footer-height, 0px) + var(--footer-gap, 0px)) 0;
    background: rgba(3, 10, 16, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--app-base-unit) * 1.2);
    z-index: 1200;
    backdrop-filter: blur(6px);
}

.routine-preview-card {
    width: min(520px, 92vw);
    background: linear-gradient(160deg, rgba(9, 18, 28, 0.96), rgba(12, 28, 38, 0.98));
    border: 1px solid rgba(0, 229, 226, 0.3);
    border-radius: calc(var(--app-base-unit) * 0.6);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 0.9);
    padding: calc(var(--app-base-unit) * 1.2);
    color: #e7fbff;
}

.routine-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: calc(var(--app-base-unit) * 0.8);
}

.routine-preview-title {
    font-size: calc(var(--app-base-unit) * 1.1);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.routine-preview-date {
    color: rgba(255, 255, 255, 0.7);
    font-size: calc(var(--app-base-unit) * 0.85);
}

.routine-preview-close {
    border: none;
    background: rgba(0, 229, 226, 0.1);
    color: #e7fbff;
    font-size: calc(var(--app-base-unit) * 1.1);
    border-radius: 999px;
    width: calc(var(--app-base-unit) * 1.8);
    height: calc(var(--app-base-unit) * 1.8);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.routine-preview-body {
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 0.6);
}

.routine-preview-row {
    display: flex;
    justify-content: space-between;
    gap: calc(var(--app-base-unit) * 0.6);
    font-size: calc(var(--app-base-unit) * 0.88);
}

.routine-preview-label {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.routine-preview-value {
    color: #e7fbff;
    font-weight: 600;
    text-align: right;
}

.routine-preview-section {
    border-top: 1px solid rgba(0, 229, 226, 0.2);
    padding-top: calc(var(--app-base-unit) * 0.6);
}

.routine-preview-section-title {
    font-size: calc(var(--app-base-unit) * 0.85);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: calc(var(--app-base-unit) * 0.4);
}

.routine-preview-signals {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-base-unit) * 0.4);
}

    .routine-preview-signals li {
        display: flex;
        justify-content: space-between;
        gap: calc(var(--app-base-unit) * 0.6);
        font-size: calc(var(--app-base-unit) * 0.85);
        padding: 0.3rem 0.45rem;
        border-radius: calc(var(--app-base-unit) * 0.35);
        background: rgba(0, 229, 226, 0.08);
        border: 1px solid rgba(0, 229, 226, 0.2);
    }

    .routine-preview-signals .signal-name {
        font-weight: 600;
    }

    .routine-preview-signals .signal-value {
        color: rgba(231, 251, 255, 0.8);
    }

.routine-preview-footer {
    display: flex;
    justify-content: flex-end;
    gap: calc(var(--app-base-unit) * 0.5);
}

.routine-preview-edit {
    padding: 0.5rem 1.2rem;
    border-radius: calc(var(--app-base-unit) * 0.4);
    border: 1px solid rgba(0, 229, 226, 0.6);
    background: rgba(0, 229, 226, 0.2);
    color: #e7fbff;
    font-weight: 700;
    cursor: pointer;
}

.day-routines {
    margin-top: calc(var(--app-base-unit) * 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 0.12rem;
}

    .day-routines.day-routines-compact {
        gap: 0.2rem;
    }

        .day-routines.day-routines-compact .routine-pill {
            width: auto;
            padding: 0.14rem 0.2rem;
        }

        .day-routines.day-routines-compact .routine-pill-header {
            width: auto;
        }

        .day-routines.day-routines-compact .routine-time {
            padding: 0.02rem 0.28rem;
        }

.routine-pill {
    display: flex;
    align-items: center;
    gap: 0.18rem;
    padding: 0.18rem 0.22rem 0.18rem 0.32rem;
    border-radius: 4px;
    background: linear-gradient(145deg, rgba(0, 229, 226, 0.28), rgba(0, 229, 226, 0.12));
    color: #001a1a;
    font-weight: 700;
    font-size: 0.64rem;
    border: 1px solid rgba(0, 229, 226, 0.5);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
    pointer-events: auto;
    min-width: 0;
    width: 100%;
    font: inherit;
    cursor: pointer;
    text-align: left;
    appearance: none;
}

    .routine-pill:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 18px rgba(0, 229, 226, 0.26);
    }

.routine-pill-header {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    width: 100%;
    min-width: 0;
}

.routine-pill .routine-time {
    font-weight: 700;
    color: #00e5e2;
    background: rgba(0, 229, 226, 0.12);
    border: 1px solid rgba(0, 229, 226, 0.3);
    border-radius: 5px;
    padding: 0.04rem 0.32rem;
    font-size: 0.62rem;
    letter-spacing: 0.01em;
}

.routine-pill .routine-name {
    color: #f4feff;
    font-weight: 700;
    letter-spacing: 0.01em;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.routine-time-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
}

.routine-recurring-icon {
    color: #9de7e6;
    font-size: 0.78rem;
    line-height: 1;
}

.routine-time-vertical {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.08rem;
}

    .routine-time-vertical .routine-interval {
        font-size: 0.62rem;
        color: #9de7e6;
        letter-spacing: 0.01em;
    }

.routine-pill-delete {
    border: none;
    background: rgba(0, 0, 0, 0.18);
    color: #fefefe;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.68rem;
    cursor: pointer;
    transition: background 120ms ease, transform 120ms ease, color 120ms ease;
}

    .routine-pill-delete:hover {
        background: rgba(255, 94, 94, 0.65);
        color: #fff4f4;
        transform: translateY(-1px);
    }

    .routine-pill-delete:focus-visible {
        outline: 2px solid rgba(255, 94, 94, 0.85);
        outline-offset: 1px;
    }
