/*!****************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./components/widgets/widgets.css ***!
  \****************************************************************************************************************************************************************************************************************************************************************************/
/* ── Base Widget Shell ── */
.widget {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.2s;
}

.widget:hover {
    border-color: var(--border-accent);
}

.widget-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.widget-icon {
    color: var(--zel-blue-light);
    flex-shrink: 0;
}

.widget-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex: 1 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-live-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--zel-green);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 4px;
    padding: 1px 5px;
    animation: pulse-dot 2s infinite;
}

.widget-error {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--zel-red);
    font-size: 0.8rem;
    margin: auto 0;
}

/* ── Gauge ── */
.gauge-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
}

.gauge-unit {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.gauge-range {
    display: flex;
    justify-content: space-between;
    width: 140px;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ── Toggle ── */
.toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}

.toggle-btn:hover:not(:disabled) {
    transform: scale(1.08);
}

.toggle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ══════════════════════════════════════════
   STAT CARD WIDGET
══════════════════════════════════════════ */
.stat-card {
    flex-direction: row;
    align-items: center;
    gap: 0.9rem;
    position: relative;
    overflow: hidden;
    padding: 1rem 1.1rem;
}

.stat-icon {
    font-size: 2rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
}

.stat-body {
    flex: 1 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.stat-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
}

.stat-trend {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 4px;
    border-radius: 4px;
    align-self: center;
}

.stat-trend.up {
    color: var(--zel-green);
    background: rgba(16, 185, 129, 0.12);
}

.stat-trend.down {
    color: var(--zel-red);
    background: rgba(239, 68, 68, 0.12);
}

.stat-glow {
    position: absolute;
    right: -20px;
    bottom: -30px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

/* ══════════════════════════════════════════
   PROGRESS BAR WIDGET
══════════════════════════════════════════ */
.progress-widget {
    justify-content: center;
    gap: 0.5rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.progress-track {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 8px;
    min-width: 4px;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* ══════════════════════════════════════════
   LED / INDICATOR WIDGET
══════════════════════════════════════════ */
.led-widget {
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.led-indicator {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.led-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--led-color, #555);
    box-shadow: 0 0 12px var(--led-color, #555), 0 0 24px var(--led-color, #55555566);
    transition: background 0.4s, box-shadow 0.4s;
    z-index: 1;
}

.led-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--led-color, #555);
    opacity: 0.4;
    animation: led-pulse 2s ease-in-out infinite;
    transition: border-color 0.4s;
}

@keyframes led-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.4;
    }

    50% {
        transform: scale(1.25);
        opacity: 0.1;
    }
}

.led-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.led-status {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    transition: color 0.4s;
}

/* ══════════════════════════════════════════
   RELAY CONTROL WIDGET
══════════════════════════════════════════ */
.relay-widget {
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.relay-header {
    padding: 0.8rem 1rem 0.75rem;
    border-bottom: 1px solid var(--bg-glass-border);
}

.relay-name-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
}

.relay-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.relay-name-edit {
    background: none;
    border: 1px solid var(--bg-glass-border);
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 1px 6px;
    transition: color 0.2s, border-color 0.2s;
}

.relay-name-edit:hover {
    color: var(--zel-blue-light);
    border-color: var(--zel-blue-light);
}

.relay-name-input {
    flex: 1 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-accent);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 3px 8px;
    font-size: 0.9rem;
    outline: none;
}

.relay-name-save {
    background: var(--zel-green);
    border: none;
    border-radius: 5px;
    color: #000;
    font-weight: 700;
    cursor: pointer;
    padding: 3px 8px;
}

/* Mode tabs */
.relay-mode-tabs {
    display: flex;
    gap: 4px;
}

.relay-mode-tab {
    flex: 1 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 5px 2px;
    text-align: center;
    transition: all 0.2s;
    white-space: nowrap;
}

.relay-mode-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.relay-mode-tab.active {
    background: rgba(139, 92, 246, 0.18);
    border-color: rgba(139, 92, 246, 0.5);
    color: #a78bfa;
}

.relay-body {
    flex: 1 1;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Manual mode */
.relay-manual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.relay-power-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: transform 0.15s;
    -webkit-user-select: none;
       -moz-user-select: none;
            user-select: none;
}

.relay-power-btn:active:not(.busy) {
    transform: scale(0.93);
}

.relay-power-btn.busy {
    cursor: wait;
    opacity: 0.7;
}

.relay-power-btn.on {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.25), transparent);
}

.relay-power-btn.off {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.18), transparent);
}

.relay-power-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0.25;
}

.relay-power-btn.on .relay-power-ring {
    border-color: var(--zel-green);
    opacity: 0.5;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.35);
}

.relay-power-btn.off .relay-power-ring {
    border-color: rgba(255, 255, 255, 0.12);
}

.relay-power-icon {
    font-size: 1.8rem;
    line-height: 1;
    transition: color 0.3s, text-shadow 0.3s;
}

.relay-power-btn.on .relay-power-icon {
    color: var(--zel-green);
    text-shadow: 0 0 16px var(--zel-green);
}

.relay-power-btn.off .relay-power-icon {
    color: rgba(255, 255, 255, 0.25);
}

.relay-state-text {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.relay-state-text.on {
    color: var(--zel-green);
}

.relay-state-text.off {
    color: var(--text-muted);
}

.relay-state-text.small {
    font-size: 0.72rem;
}

/* Auto / Schedule */
.relay-auto,
.relay-schedule {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.relay-input-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    width: 100%;
}

.relay-input-group {
    flex: 1 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.relay-input-group label {
    font-size: 0.67rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.relay-number-input {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-glass-border);
    border-radius: 8px;
    overflow: hidden;
}

.relay-number-input input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-mono);
    padding: 5px 8px;
    width: 0;
    flex: 1 1;
    outline: none;
    -moz-appearance: textfield;
}

.relay-number-input input::-webkit-outer-spin-button,
.relay-number-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.relay-number-input span {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0 8px 0 0;
}

.relay-time-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 5px 8px;
    outline: none;
    width: 100%;
    font-family: var(--font-mono);
    color-scheme: dark;
}

.relay-divider {
    color: var(--text-muted);
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 16px;
}

.relay-auto-cycle {
    text-align: center;
}

.relay-schedule-preview {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    padding: 6px 10px;
}

/* AI Mode */
.relay-ai {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.relay-ai-orb {
    width: 60px;
    height: 60px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.relay-ai-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(139, 92, 246, 0.5);
    animation: ai-spin 3s linear infinite;
}

@keyframes ai-spin {
    from {
        transform: rotate(0deg) scale(1);
        border-color: rgba(139, 92, 246, 0.5);
    }

    50% {
        transform: rotate(180deg) scale(1.1);
        border-color: rgba(59, 130, 246, 0.7);
    }

    to {
        transform: rotate(360deg) scale(1);
        border-color: rgba(139, 92, 246, 0.5);
    }
}

.relay-ai-core {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.35), rgba(59, 130, 246, 0.15));
    border: 1px solid rgba(139, 92, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: #a78bfa;
    letter-spacing: 0.05em;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.relay-ai-status {
    font-size: 0.72rem;
    color: #a78bfa;
    text-align: center;
    font-style: italic;
}

.relay-ai-note {
    font-size: 0.67rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
    border-top: 1px solid var(--bg-glass-border);
    padding-top: 0.4rem;
    width: 100%;
}

/* Utilities */
.w-full {
    width: 100%;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

/* ══════════════════════════════════════════
   RELAY — Multi-schedule list
══════════════════════════════════════════ */
.relay-schedule-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-height: 160px;
    overflow-y: auto;
}

.relay-schedule-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.relay-schedule-num {
    font-size: 0.65rem;
    color: var(--text-muted);
    width: 16px;
    flex-shrink: 0;
}

.relay-time-compact {
    width: 90px !important;
    padding: 4px 6px !important;
    font-size: 0.8rem !important;
}

.relay-dur-compact {
    width: 70px !important;
}

.relay-schedule-del {
    background: none;
    border: none;
    color: var(--zel-red);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 5px;
    border-radius: 4px;
    opacity: 0.6;
}

.relay-schedule-del:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

.relay-add-schedule-btn {
    background: rgba(139, 92, 246, 0.1);
    border: 1px dashed rgba(139, 92, 246, 0.4);
    border-radius: 8px;
    color: #a78bfa;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 10px;
    width: 100%;
    transition: all 0.2s;
}

.relay-add-schedule-btn:hover {
    background: rgba(139, 92, 246, 0.2);
}

/* ══════════════════════════════════════════
   VERTICAL TANK WIDGET
══════════════════════════════════════════ */
.tank-widget {
    align-items: center;
    gap: 0.3rem;
}

.tank-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.tank-body {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex: 1 1;
    width: 100%;
}

.tank-outer {
    flex: 1 1;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px 8px 4px 4px;
    position: relative;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    min-height: 80px;
}

.tank-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 0 4px 4px;
}

.tank-pct-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.tank-bubble {
    position: absolute;
    border-radius: 50%;
    animation: bubble-rise 3s ease-in infinite;
}

.tank-bubble.b1 {
    width: 8px;
    height: 8px;
    left: 35%;
    animation-duration: 2.5s;
}

.tank-bubble.b2 {
    width: 5px;
    height: 5px;
    left: 60%;
    animation-duration: 3.5s;
    animation-delay: 1s;
}

@keyframes bubble-rise {
    0% {
        bottom: 5%;
        opacity: 0.6;
    }

    100% {
        bottom: 95%;
        opacity: 0;
    }
}

.tank-scale {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px 0;
}

.tank-scale-mark {
    display: flex;
    align-items: center;
    gap: 3px;
}

.tank-scale-mark span {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.tank-scale-tick {
    width: 6px;
    height: 1px;
    background: var(--text-muted);
    opacity: 0.4;
}

.tank-footer {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.tank-litres {
    color: var(--text-muted);
    font-weight: 400;
}

/* ══════════════════════════════════════════
   SPARKLINE WIDGET
══════════════════════════════════════════ */
.sparkline-widget {
    gap: 0.3rem;
}

.sparkline-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sparkline-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.sparkline-live {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.sparkline-chart {
    flex: 1 1;
    min-height: 0;
}

.sparkline-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.67rem;
    color: var(--text-muted);
}

.spark-tooltip {
    background: var(--bg-elevated);
    border: 1px solid var(--border-accent);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.75rem;
}

/* ══════════════════════════════════════════
   CLIMATE CARD WIDGET
══════════════════════════════════════════ */
.climate-widget {}

.climate-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 0.5rem;
    gap: 0.5rem;
    flex: 1 1;
}

.climate-cell {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-glass-border);
    border-radius: 8px;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
}

.climate-cell-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.climate-cell-val {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-mono);
    transition: color 0.4s;
}

.climate-cell-unit {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

.climate-cell-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* ══════════════════════════════════════════
   PWM SLIDER WIDGET
══════════════════════════════════════════ */
.pwm-widget {
    justify-content: center;
    gap: 0.5rem;
}

.pwm-display {
    font-size: 2.2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-align: center;
}

.pwm-feedback {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

.pwm-sending {
    font-size: 0.7rem;
    color: var(--zel-amber);
    margin-left: auto;
}

.pwm-slider {
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
         appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--pwm-color) var(--pwm-pct), rgba(255, 255, 255, 0.1) var(--pwm-pct));
    outline: none;
    cursor: pointer;
}

.pwm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--pwm-color);
    cursor: pointer;
    box-shadow: 0 0 8px var(--pwm-color);
}

.pwm-presets {
    display: flex;
    gap: 4px;
    justify-content: space-between;
}

.pwm-preset {
    flex: 1 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--bg-glass-border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px;
    transition: all 0.2s;
}

.pwm-preset:hover {
    background: rgba(255, 255, 255, 0.08);
}

.pwm-preset.active {
    font-weight: 700;
}

/* ══════════════════════════════════════════
   DOSING WIDGET
══════════════════════════════════════════ */
.dosing-widget {
    gap: 0.5rem;
}

.dosing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 0.5rem;
    gap: 0.5rem;
    flex: 1 1;
}

.dose-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--dose-color, var(--bg-glass-border));
    border-radius: 8px;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-opacity: 0.3;
    box-shadow: 0 0 0 1px transparent;
    transition: box-shadow 0.2s;
}

.dose-card:hover {
    box-shadow: 0 0 0 1px var(--dose-color, var(--border-accent));
}

.dose-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px;
}

.dose-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dose-last {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.dose-controls {
    display: flex;
    gap: 4px;
    align-items: center;
}

.dose-amount-input {
    flex: 1 1 !important;
}

.dose-btn {
    border: none;
    border-radius: 6px;
    color: #000;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 5px 8px;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.dose-btn:disabled,
.dose-btn.busy {
    opacity: 0.5;
    cursor: wait;
}

/* ══════════════════════════════════════════
   CAMERA STREAM WIDGET
══════════════════════════════════════════ */
.cam-widget {
    gap: 0;
    padding: 0;
}

.cam-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    flex-shrink: 0;
}

.cam-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.cam-controls {
    display: flex;
    gap: 6px;
}

.cam-ai-btn {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 6px;
    color: #a78bfa;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 3px 8px;
    transition: all 0.2s;
}

.cam-ai-btn.active {
    background: rgba(139, 92, 246, 0.3);
    border-color: #a78bfa;
}

.cam-frame {
    flex: 1 1;
    position: relative;
    background: #000;
    overflow: hidden;
    min-height: 100px;
}

.cam-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.cam-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 1rem;
}

.cam-placeholder-icon {
    font-size: 2rem;
}

.cam-url {
    font-size: 0.65rem;
    opacity: 0.5;
    word-break: break-all;
}

.cam-error-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: #f59e0b;
    font-size: 0.8rem;
}

.cam-ai-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(139, 92, 246, 0.8);
    border-radius: 4px;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
}

/* ══════════════════════════════════════════
   MULTI-CAM GRID WIDGET
══════════════════════════════════════════ */
.multicam-widget {}

.multicam-grid {
    display: grid;
    grid-template-columns: repeat(var(--mc-cols, 2), 1fr);
    grid-gap: 4px;
    gap: 4px;
    flex: 1 1;
}

.mc-cell {
    position: relative;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 16/9;
    transition: all 0.2s;
}

.mc-cell.mc-fullscreen {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    z-index: 10;
}

.mc-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mc-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 4px;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.mc-placeholder span {
    font-size: 0.65rem;
}

.mc-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-size: 0.65rem;
    padding: 4px 6px;
}

.mc-expand {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.mc-cell:hover .mc-expand {
    opacity: 0.7;
}

/* ══════════════════════════════════════════
   EVENT LOG WIDGET
══════════════════════════════════════════ */
.log-widget {}

.log-clear-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--bg-glass-border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.65rem;
    padding: 1px 7px;
}

.log-clear-btn:hover {
    color: var(--text-primary);
}

.log-body {
    flex: 1 1;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.log-line {
    display: flex;
    gap: 6px;
    line-height: 1.5;
}

.log-ts {
    color: var(--text-muted);
    flex-shrink: 0;
}

.log-msg {
    flex: 1 1;
    word-break: break-word;
}

/* ══════════════════════════════════════════
   ALARM BANNER WIDGET
══════════════════════════════════════════ */
.alarm-widget {}

.alarm-ok-badge {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--zel-green);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 4px;
    padding: 1px 6px;
}

.alarm-clear {
    flex: 1 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.alarm-clear-icon {
    font-size: 2rem;
}

.alarm-clear-text {
    font-weight: 600;
    color: var(--zel-green);
}

.alarm-monitoring {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.alarm-list {
    flex: 1 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.alarm-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    border-radius: 8px;
    padding: 0.7rem;
    border: 1px solid;
    position: relative;
    overflow: hidden;
}

.alarm-critical {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
    animation: alarm-flash 1.5s ease-in-out infinite;
}

.alarm-warn {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.35);
}

@keyframes alarm-flash {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.alarm-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
}

.alarm-critical .alarm-pulse {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
    animation: alarm-flash 0.8s ease-in-out infinite;
}

.alarm-warn .alarm-pulse {
    background: #f59e0b;
}

.alarm-content {
    flex: 1 1;
}

.alarm-msg {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.alarm-val {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.alarm-mute-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.6;
    flex-shrink: 0;
}

.alarm-mute-btn:hover {
    opacity: 1;
}

/* ══════════════════════════════════════════
   THRESHOLD RULE WIDGET
══════════════════════════════════════════ */
.rule-widget {}

.rule-add-btn {
    margin-left: auto;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    color: #a78bfa;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    transition: all 0.2s;
}

.rule-add-btn:hover {
    background: rgba(139, 92, 246, 0.25);
}

.rule-form {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-glass-border);
    border-radius: 8px;
    padding: 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.rule-form-row {
    display: flex;
    gap: 6px;
}

.rule-input {
    flex: 1 1;
}

.rule-select {
    flex: 0 0 60px;
}

.rule-input-sm {
    flex: 0 0 70px;
}

.rule-list {
    flex: 1 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rule-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 1rem 0;
}

.rule-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-glass-border);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
}

.rule-row.rule-disabled {
    opacity: 0.45;
}

.rule-info {
    flex: 1 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.rule-cond,
.rule-action {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.rule-cond strong,
.rule-action strong {
    color: var(--text-primary);
}

.rule-label-tag {
    font-size: 0.65rem;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 4px;
    color: #a78bfa;
    padding: 1px 5px;
}

.rule-controls {
    display: flex;
    gap: 4px;
}

.rule-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.rule-toggle.on {
    color: var(--zel-green);
}

.rule-toggle.off {
    color: var(--text-muted);
}

.rule-del {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
}

.rule-del:hover {
    color: var(--zel-red);
}

/* ══════════════════════════════════════════
   NOVNC WIDGET
══════════════════════════════════════════ */
.novnc-widget {
    gap: 0;
    padding: 0;
}

.novnc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--bg-glass-border);
    flex-shrink: 0;
}

.novnc-close {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    color: var(--zel-red);
    cursor: pointer;
    font-size: 0.72rem;
    padding: 3px 8px;
}

.novnc-connect-screen {
    flex: 1 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1.5rem;
    text-align: center;
}

.novnc-icon {
    font-size: 2.5rem;
}

.novnc-title {
    font-size: 0.9rem;
    font-weight: 700;
}

.novnc-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.novnc-warning {
    font-size: 0.72rem;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 6px;
    padding: 6px 10px;
}

.novnc-frame {
    flex: 1 1;
    width: 100%;
    border: none;
}

.novnc-placeholder {
    flex: 1 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 1rem;
}

.novnc-hint {
    font-size: 0.65rem;
    opacity: 0.6;
}
/*!*******************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./node_modules/react-grid-layout/css/styles.css ***!
  \*******************************************************************************************************************************************************************************************************************************************************************************************/
.react-grid-layout {
  position: relative;
  transition: height 200ms ease;
}
.react-grid-item {
  transition: all 200ms ease;
  transition-property: left, top, width, height;
}
.react-grid-item img {
  pointer-events: none;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}
.react-grid-item.cssTransforms {
  transition-property: transform, width, height;
}
.react-grid-item.resizing {
  transition: none;
  z-index: 1;
  will-change: width, height;
}

.react-grid-item.react-draggable-dragging {
  transition: none;
  z-index: 3;
  will-change: transform;
}

.react-grid-item.dropping {
  visibility: hidden;
}

.react-grid-item.react-grid-placeholder {
  background: red;
  opacity: 0.2;
  transition-duration: 100ms;
  z-index: 2;
  -webkit-user-select: none;
  -moz-user-select: none;
  -o-user-select: none;
  user-select: none;
}

.react-grid-item.react-grid-placeholder.placeholder-resizing {
  transition: none;
}

.react-grid-item > .react-resizable-handle {
  position: absolute;
  width: 20px;
  height: 20px;
}

.react-grid-item > .react-resizable-handle::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 5px;
  height: 5px;
  border-right: 2px solid rgba(0, 0, 0, 0.4);
  border-bottom: 2px solid rgba(0, 0, 0, 0.4);
}

.react-resizable-hide > .react-resizable-handle {
  display: none;
}

.react-grid-item > .react-resizable-handle.react-resizable-handle-sw {
  bottom: 0;
  left: 0;
  cursor: sw-resize;
  transform: rotate(90deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-se {
  bottom: 0;
  right: 0;
  cursor: se-resize;
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-nw {
  top: 0;
  left: 0;
  cursor: nw-resize;
  transform: rotate(180deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-ne {
  top: 0;
  right: 0;
  cursor: ne-resize;
  transform: rotate(270deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-w,
.react-grid-item > .react-resizable-handle.react-resizable-handle-e {
  top: 50%;
  margin-top: -10px;
  cursor: ew-resize;
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-w {
  left: 0;
  transform: rotate(135deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-e {
  right: 0;
  transform: rotate(315deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-n,
.react-grid-item > .react-resizable-handle.react-resizable-handle-s {
  left: 50%;
  margin-left: -10px;
  cursor: ns-resize;
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-n {
  top: 0;
  transform: rotate(225deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-s {
  bottom: 0;
  transform: rotate(45deg);
}

/*!*****************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./node_modules/react-resizable/css/styles.css ***!
  \*****************************************************************************************************************************************************************************************************************************************************************************************/
.react-resizable {
  position: relative;
}
.react-resizable-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  background-repeat: no-repeat;
  background-origin: content-box;
  box-sizing: border-box;
  background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+');
  background-position: bottom right;
  padding: 0 3px 3px 0;
}
.react-resizable-handle-sw {
  bottom: 0;
  left: 0;
  cursor: sw-resize;
  transform: rotate(90deg);
}
.react-resizable-handle-se {
  bottom: 0;
  right: 0;
  cursor: se-resize;
}
.react-resizable-handle-nw {
  top: 0;
  left: 0;
  cursor: nw-resize;
  transform: rotate(180deg);
}
.react-resizable-handle-ne {
  top: 0;
  right: 0;
  cursor: ne-resize;
  transform: rotate(270deg);
}
.react-resizable-handle-w,
.react-resizable-handle-e {
  top: 50%;
  margin-top: -10px;
  cursor: ew-resize;
}
.react-resizable-handle-w {
  left: 0;
  transform: rotate(135deg);
}
.react-resizable-handle-e {
  right: 0;
  transform: rotate(315deg);
}
.react-resizable-handle-n,
.react-resizable-handle-s {
  left: 50%;
  margin-left: -10px;
  cursor: ns-resize;
}
.react-resizable-handle-n {
  top: 0;
  transform: rotate(225deg);
}
.react-resizable-handle-s {
  bottom: 0;
  transform: rotate(45deg);
}
/*!*************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./app/(dashboard)/dashboard/dashboard.css ***!
  \*************************************************************************************************************************************************************************************************************************************************************************************/
.dashboard-page {
    max-width: 1400px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin-bottom: 0.1rem;
}

/* ── Empty State ── */
.dashboard-empty {
    margin-top: 4rem;
    padding: 5rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}

.empty-icon-wrap {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* ── Grid Items ── */
.grid-item {
    position: relative;
}

.widget-drag-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 40px;
    height: 36px;
    cursor: -webkit-grab;
    cursor: grab;
    z-index: 10;
    border-radius: var(--radius) var(--radius) 0 0;
}

.widget-drag-area:active {
    cursor: -webkit-grabbing;
    cursor: grabbing;
}

.widget-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 20;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--zel-red);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
}

.grid-item:hover .widget-remove-btn {
    opacity: 1;
}

/* ── Add Widget Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-start;
    /* keeps top always visible */
    justify-content: center;
    z-index: 1000;
    padding: 2rem 1rem;
    /* 2rem top padding = never clips header */
    overflow-y: auto;
    /* scroll the overlay if content is taller than viewport */
}

.modal-box {
    width: 100%;
    max-width: 560px;
    padding: 1.75rem;
    animation: modalSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    /* No max-height needed — overlay scrolls instead */
    flex-shrink: 0;
    /* don't squish when overlay scrolls */
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-title {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* ── Widget Type Picker ── */
.widget-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    grid-gap: 0.65rem;
    gap: 0.65rem;
    margin-bottom: 0.5rem;
}

.widget-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.9rem 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    transition: all var(--transition);
    font-family: var(--font-sans);
}

.widget-type-card:hover {
    border-color: rgba(139, 92, 246, 0.45);
    background: rgba(139, 92, 246, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.15);
}

.widget-type-icon {
    font-size: 1.5rem;
    line-height: 1;
    margin-bottom: 0.1rem;
}

.widget-type-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.widget-type-desc {
    font-size: 0.64rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* select element */
select.input {
    cursor: pointer;
}

select.input option {
    background: var(--bg-elevated);
}

/* ── Modal Back link ── */
.modal-back {
    cursor: pointer;
    opacity: 0.6;
    margin-right: 4px;
}

.modal-back:hover {
    opacity: 1;
}

/* ── Category Tabs ── */
.modal-cat-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.modal-cat-tab {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    border-radius: 20px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    transition: all 0.2s;
}

.modal-cat-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.modal-cat-tab.active {
    background: rgba(139, 92, 246, 0.18);
    border-color: rgba(139, 92, 246, 0.5);
    color: #a78bfa;
}
