.operations-hero,
.section-head,
.rules-head,
.operations-hero-actions,
.ops-device-top,
.ops-device-foot,
.alert-item-head,
.alert-item-foot,
.quality-rule-top,
.quality-rule-fields,
.form-actions {
    display: flex;
    align-items: center;
}

.operations-hero,
.section-head,
.rules-head,
.ops-device-top,
.ops-device-foot,
.alert-item-head,
.alert-item-foot,
.quality-rule-top {
    justify-content: space-between;
    gap: 16px;
}

.operations-hero {
    align-items: flex-start;
}

.operations-hero h1 {
    margin: 3px 0 5px;
}

.operations-hero-actions {
    flex: 0 0 auto;
    gap: 8px;
}

.refresh-chip,
.updated-at,
.count-badge,
.state-pill,
.severity-pill,
.rule-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
}

.refresh-chip {
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid #d8e5da;
    background: #f4faf5;
    color: #397c4c;
}

.operations-stats {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-top: 19px;
}

.ops-stat {
    padding: 13px 14px;
    border: 1px solid #dfe8e0;
    border-radius: 13px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.ops-stat span {
    display: block;
    color: #87928a;
    font-size: 9px;
    font-weight: 760;
}

.ops-stat strong {
    display: block;
    margin-top: 4px;
    color: #35423a;
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}

.ops-stat.online strong { color: #2f8f4e; }
.ops-stat.delayed strong { color: #b47a1f; }
.ops-stat.offline strong,
.ops-stat.alert strong { color: #b14949; }
.ops-stat.quality strong { color: #47759d; }
.ops-stat.notification strong { color: #397c4c; }

.operations-panel {
    margin-top: 14px;
}

.template-panel { margin-top: 14px; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.template-form,
.template-apply-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border: 1px solid #dfe9e0;
    border-radius: 12px;
    background: #f8fbf8;
}
.template-form-title,
.template-form-hint,
.template-name-field,
.selected-template-info,
.template-target-list { grid-column: 1 / -1; }
.template-form-title { color: #455449; font-size: 10px; font-weight: 820; }
.template-form .field { min-width: 0; }
.template-form label { display: block; margin-bottom: 4px; color: #69766d; font-size: 9px; font-weight: 750; }
.template-form input,
.template-form select { width: 100%; }
.template-form .primary { justify-self: end; }
.template-form-hint { color: #7d8981; font-size: 8px; line-height: 1.45; }
.selected-template-info { min-height: 32px; padding: 8px 9px; border: 1px solid #dce8de; border-radius: 8px; background: #fff; color: #637067; font-size: 9px; line-height: 1.45; }
.selected-template-info strong { color: #397c4c; }
.template-target-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; min-height: 42px; }
.template-target-option { display: grid; grid-template-columns: 15px minmax(0, 1fr); column-gap: 5px; align-items: center; padding: 7px; border: 1px solid #dfe8e1; border-radius: 8px; background: #fff; color: #4b594f; font-size: 9px; cursor: pointer; }
.template-target-option input { width: 14px; min-height: 14px; margin: 0; accent-color: var(--green-700); }
.template-target-option small { grid-column: 2; margin-top: 2px; color: #87928a; font-size: 8px; }
.template-target-empty { padding: 8px; color: #87928a; font-size: 9px; }
.template-apply-panel .primary { justify-self: end; }
.template-apply-panel .primary:disabled { cursor: not-allowed; opacity: .55; }
.rule-template-list { display: grid; gap: 8px; margin-top: 10px; }
.rule-template-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 11px; border: 1px solid #dfe8e1; border-radius: 10px; background: #fff; }
.rule-template-row.selected { border-color: #8cb99a; background: #f6fbf6; }
.rule-template-name { color: #3f4d44; font-size: 10px; font-weight: 800; }
.template-type-chip { display: inline-flex; align-items: center; min-height: 21px; margin-right: 6px; padding: 0 7px; border-radius: 999px; background: #edf6ef; color: #377c4b; font-size: 8px; font-weight: 800; }
.template-type-chip.alert { background: #fff4e6; color: #9b6920; }
.rule-template-actions { display: flex; gap: 5px; }
.rule-template-actions button { min-height: 28px; padding: 4px 7px; font-size: 8px; }
.template-message { min-height: 16px; margin-top: 8px; color: #728076; font-size: 9px; }
.template-message.error { color: #ae4b4b; }
.template-message.ok { color: #3c874f; }

.operations-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.advanced-operations {
    margin-top: 14px;
    border: 1px solid #dfe8e1;
    border-radius: 13px;
    background: #fff;
}

.advanced-operations > summary {
    padding: 13px 14px;
    color: #657168;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.advanced-operations[open] > summary {
    border-bottom: 1px solid #e7eee8;
}

.advanced-operations .template-panel,
.advanced-operations .rules-grid {
    margin: 14px;
}

.simple-threshold-panel {
    padding-bottom: 14px;
}

.simple-threshold-guide {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px 11px;
    margin-top: 12px;
    padding: 9px 11px;
    border: 1px solid #dbe9dd;
    border-radius: 10px;
    background: #f5faf5;
    color: #5d6d62;
    font-size: 9px;
    line-height: 1.45;
}

.simple-threshold-guide strong { color: #397c4c; font-size: 10px; }
.simple-threshold-guide span { white-space: nowrap; }
.simple-threshold-guide b { display: inline-grid; width: 15px; height: 15px; place-items: center; margin-right: 3px; border-radius: 50%; background: #dcefe0; color: #397c4c; font-size: 8px; }
.simple-threshold-guide em { color: #7e8981; font-style: normal; }

.simple-threshold-list { display: grid; gap: 9px; margin-top: 12px; }

.simple-threshold-row {
    padding: 12px;
    border: 1px solid #dfe8e1;
    border-radius: 11px;
    background: #fff;
}

.simple-threshold-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.simple-threshold-title strong { color: #3b4941; font-size: 11px; }
.simple-threshold-title small { display: block; margin-top: 4px; color: #87928a; font-size: 8px; }

.range-state {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 8px;
    font-weight: 800;
    white-space: nowrap;
}

.range-state.active { background: #edf8ef; color: #2f7d4a; }
.range-state.idle { background: #f1f3f1; color: #78827a; }

.simple-threshold-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 9px;
    align-items: end;
    margin-top: 11px;
}

.simple-threshold-fields label {
    display: block;
    color: #69766d;
    font-size: 9px;
    font-weight: 750;
}

.simple-input-wrap {
    display: flex;
    align-items: center;
    margin-top: 4px;
    overflow: hidden;
    border: 1px solid #ccd9cf;
    border-radius: 8px;
    background: #fff;
}

.simple-input-wrap input { width: 100%; min-width: 0; min-height: 34px; padding: 0 9px; border: 0; border-radius: 0; background: transparent; }
.simple-input-wrap i { flex: 0 0 auto; padding: 0 8px; color: #77837a; font-size: 8px; font-style: normal; white-space: nowrap; }
.save-simple-threshold { min-height: 34px; white-space: nowrap; }
.simple-threshold-message { min-height: 16px; margin-top: 8px; color: #728076; font-size: 9px; }
.simple-threshold-message.error { color: #ae4b4b; }
.simple-threshold-message.ok { color: #3c874f; }

.rules-grid {
    align-items: start;
}

.updated-at {
    color: #8b958d;
    font-size: 9px;
    white-space: nowrap;
}

.ops-device-list,
.alert-list,
.quality-event-list,
.quality-rule-list,
.alert-rule-list {
    display: grid;
    gap: 9px;
    margin-top: 14px;
}

.ops-device-card {
    padding: 13px 14px;
    border: 1px solid #dfe8e1;
    border-radius: 13px;
    background: linear-gradient(145deg, #fff, #fbfdfb);
}

.ops-device-card.disabled { opacity: .72; background: #fafafa; }

.ops-device-name {
    color: #334139;
    font-size: 13px;
    font-weight: 820;
}

.ops-device-id,
.ops-meta,
.ops-device-location,
.alert-sub,
.quality-sub,
.rule-sub {
    color: #87928a;
    font-size: 9px;
}

.ops-device-id {
    margin-left: 7px;
    padding: 2px 5px;
    border: 1px solid #e1e7e2;
    border-radius: 5px;
    background: #f7f9f7;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.ops-device-location { margin-top: 4px; }

.state-pill,
.severity-pill,
.rule-chip,
.count-badge {
    min-height: 24px;
    padding: 0 8px;
}

.state-pill::before {
    width: 6px;
    height: 6px;
    margin-right: 5px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.state-pill.online { background: #edf8ef; color: #2f7d4a; }
.state-pill.delayed { background: #fff7e8; color: #966821; }
.state-pill.offline { background: #fff1f1; color: #a84444; }
.state-pill.never_online,
.state-pill.disabled,
.state-pill.unknown { background: #f1f3f1; color: #79827b; }

.ops-device-foot { margin-top: 11px; padding-top: 10px; border-top: 1px solid #eef2ee; }
.ops-device-metrics { display: flex; gap: 12px; color: #738076; font-size: 9px; }
.ops-device-metrics strong { color: #3b4940; font-variant-numeric: tabular-nums; }

.alert-item,
.quality-event-item,
.quality-rule-row,
.alert-rule-row {
    padding: 11px 12px;
    border: 1px solid #e0e8e1;
    border-radius: 11px;
    background: #fff;
}

.alert-item { border-left: 3px solid #d8922b; }
.alert-item.critical { border-left-color: #c65353; }
.quality-event-item { border-left: 3px solid #5d91b9; }

.quality-event-group {
    overflow: hidden;
    border: 1px solid #d9e5db;
    border-radius: 11px;
    background: #fff;
}

.quality-group-head,
.quality-group-actions,
.quality-event-foot {
    display: flex;
    align-items: center;
}

.quality-group-head {
    justify-content: space-between;
    gap: 10px;
    padding: 10px 11px;
    background: #f7faf7;
    border-bottom: 1px solid #e6eee7;
}

.quality-group-title { color: #3d4c42; font-size: 10px; font-weight: 820; }
.quality-group-sub { margin-top: 3px; color: #839086; font-size: 8px; }
.quality-group-actions { flex: 0 0 auto; gap: 5px; }
.quality-group-actions button,
.quality-event-foot button,
.toggle-quality-history {
    min-height: 28px;
    padding: 4px 7px;
    font-size: 8px;
}
.clear-quality-group,
.clear-quality-event { color: #a24a4a; border-color: #ecd3d3; background: #fffafa; }
.quality-group-list { display: grid; gap: 7px; padding: 8px; }
.quality-event-group.collapsed .quality-group-list { display: none; }
.quality-event-group.collapsed .quality-group-head { border-bottom: 0; }
.quality-event-group .quality-event-item { padding: 9px 10px; border-radius: 8px; background: #fff; }
.quality-event-foot { justify-content: space-between; gap: 9px; margin-top: 7px; }
.quality-event-foot .quality-sub { min-width: 0; }
.toggle-quality-history { width: 100%; color: #397c4c; border-color: #cfe2d2; background: #f5faf5; }
.quality-event-message { min-height: 16px; margin-top: 8px; color: #728076; font-size: 9px; }
.quality-event-message.error { color: #ae4b4b; }
.quality-event-message.ok { color: #3c874f; }

.alert-title,
.quality-title,
.quality-rule-name,
.alert-rule-name {
    color: #3b4941;
    font-size: 10px;
    font-weight: 800;
}

.severity-pill.warning { background: #fff7e9; color: #9a6922; }
.severity-pill.critical { background: #fff0f0; color: #aa4747; }
.severity-pill.resolved { background: #edf7ef; color: #397b4b; }

.alert-message,
.quality-message {
    margin-top: 5px;
    color: #657168;
    font-size: 9px;
    line-height: 1.55;
}

.alert-item-foot { margin-top: 8px; }
.alert-item button,
.alert-rule-actions button,
.quality-rule-row button { min-height: 28px; padding: 4px 7px; font-size: 8px; }

.ops-empty {
    padding: 34px 12px;
    color: #88938b;
    text-align: center;
    font-size: 10px;
}

.quality-guide {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px 11px;
    margin-top: 12px;
    padding: 9px 11px;
    border: 1px solid #dbe9dd;
    border-radius: 10px;
    background: #f5faf5;
    color: #5d6d62;
    font-size: 9px;
    line-height: 1.45;
}

.quality-guide strong { color: #397c4c; font-size: 10px; }
.quality-guide span { white-space: nowrap; }
.quality-guide b { display: inline-grid; width: 15px; height: 15px; place-items: center; margin-right: 3px; border-radius: 50%; background: #dcefe0; color: #397c4c; font-size: 8px; }
.quality-guide em { color: #7e8981; font-style: normal; }

.quality-rule-top { align-items: flex-start; }
.quality-rule-row.disabled { background: #fafafa; opacity: .76; }
.quality-enable-switch {
    display: grid;
    grid-template-columns: 16px auto;
    column-gap: 6px;
    align-items: center;
    margin-top: 10px;
    color: #3c4c42;
    font-size: 9px;
    font-weight: 760;
    cursor: pointer;
}
.quality-enable-switch input,
.quality-check-heading input { width: 15px; min-height: 15px; margin: 0; accent-color: var(--green-700); }
.quality-enable-switch small { grid-column: 2; color: #849087; font-size: 8px; font-weight: 500; line-height: 1.45; }
.quality-check-title { margin-top: 11px; color: #5f6e64; font-size: 9px; font-weight: 800; }
.quality-check-title span { margin-left: 4px; color: #89948c; font-size: 8px; font-weight: 500; }
.quality-rule-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 10px;
}

.quality-check-card { display: block; min-width: 0; padding: 9px; border: 1px solid #dfe8e1; border-radius: 9px; background: #fbfdfb; cursor: pointer; }
.quality-check-heading { display: flex; align-items: center; gap: 5px; color: #48574d; font-size: 9px; font-weight: 800; }
.quality-input-wrap { display: flex; align-items: center; margin-top: 7px; border: 1px solid #ccd9cf; border-radius: 8px; background: #fff; overflow: hidden; }
.quality-input-wrap input { width: 100%; min-width: 0; min-height: 31px; padding: 0 8px; border: 0; border-radius: 0; background: transparent; }
.quality-input-wrap input:disabled { background: #f2f4f2; color: #9ba59d; cursor: not-allowed; }
.quality-input-wrap i { flex: 0 0 auto; padding: 0 7px; color: #77837a; font-size: 8px; font-style: normal; white-space: nowrap; }
.quality-check-card small { display: block; margin-top: 6px; color: #859087; font-size: 8px; font-weight: 500; line-height: 1.45; }

.alert-rule-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
    margin-top: 14px;
    padding: 13px;
    border: 1px solid #e0e9e1;
    border-radius: 12px;
    background: #f8fbf8;
}

.alert-rule-form .field { min-width: 0; }
.alert-rule-form label { display: block; margin-bottom: 4px; color: #69766d; font-size: 9px; font-weight: 750; }
.alert-rule-form input,
.alert-rule-form select { width: 100%; }
.ops-toggle { display: flex !important; align-items: center; gap: 7px; margin: 0 !important; padding-top: 17px; cursor: pointer; }
.ops-toggle input { width: 15px; min-height: 15px; accent-color: var(--green-700); }

.form-actions { justify-content: flex-end; gap: 7px; align-self: end; padding-top: 14px; }
.form-message { grid-column: 1 / -1; min-height: 16px; color: #6d796f; font-size: 9px; }
.form-message.error { color: #ae4b4b; }
.form-message.ok { color: #3c874f; }

.rule-list-head { margin-top: 16px; color: #6a766d; font-size: 9px; font-weight: 800; }
.alert-rule-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.alert-rule-row.disabled { background: #fafafa; opacity: .72; }
.alert-rule-actions { display: flex; gap: 5px; }
.rule-chip { margin-right: 5px; background: #eef6ef; color: #3c7d4e; }
.rule-chip.offline { background: #eef3fa; color: #4c7190; }

@media (max-width: 1180px) {
    .operations-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .operations-grid { grid-template-columns: 1fr; }
    .template-grid { grid-template-columns: 1fr; }
    .alert-rule-form { grid-template-columns: 1fr; }
    .simple-threshold-fields { grid-template-columns: 1fr; }
    .save-simple-threshold { width: 100%; }
    .ops-toggle,
    .form-actions { padding-top: 0; }
}

@media (max-width: 620px) {
    .operations-hero,
    .operations-hero-actions,
    .section-head,
    .rules-head,
    .ops-device-top,
    .ops-device-foot { align-items: flex-start; flex-direction: column; }
    .operations-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quality-rule-fields { grid-template-columns: 1fr; }
    .template-form,
    .template-apply-panel,
    .template-target-list { grid-template-columns: 1fr; }
    .rule-template-row { grid-template-columns: 1fr; }
    .ops-device-metrics { flex-wrap: wrap; }
}


/* M2.8.2.16 · unified empty/loading presentation */
.ops-empty,
.template-target-empty {
    min-height: 88px;
    display: grid;
    place-items: center;
    padding: 18px;
    border: 1px dashed #dfe6e0;
    border-radius: 12px;
    background: #fafcfb;
    color: #7b877f;
    text-align: center;
}

/* v49 · threshold strategy as the primary operation workflow */
.threshold-priority-panel {
    position: relative;
    margin-top: 18px;
    overflow: hidden;
    border-color: rgba(70, 137, 88, .22);
    background:
        linear-gradient(
            180deg,
            rgba(248, 252, 248, .98),
            rgba(255, 255, 255, .98)
        );
    box-shadow:
        0 10px 28px rgba(45, 79, 54, .045);
}

.threshold-priority-panel::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background:
        linear-gradient(
            180deg,
            #4c9d63,
            rgba(76, 157, 99, .12)
        );
}

.threshold-priority-head {
    align-items: flex-end;
}

.threshold-priority-head > div:first-child {
    min-width: 0;
}

.threshold-priority-head select {
    min-width: 260px;
    max-width: 360px;
}

.threshold-priority-kicker {
    margin-bottom: 4px;
    color: #3b8b53;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .09em;
}

.crop-template-bar {
    display: grid;
    grid-template-columns:
        minmax(260px, 1fr)
        auto
        auto;
    gap: 9px;
    align-items: end;
    margin-top: 14px;
    padding: 11px;
    border: 1px solid #dbe9dd;
    border-radius: 11px;
    background: #f5faf6;
}

.crop-template-field {
    min-width: 0;
}

.crop-template-field label {
    display: block;
    margin-bottom: 5px;
    color: #5c6d61;
    font-size: 9px;
    font-weight: 800;
}

.crop-template-field select {
    width: 100%;
}

.crop-template-bar > button {
    min-height: 36px;
    white-space: nowrap;
}

.crop-template-summary {
    grid-column: 1 / -1;
    min-height: 18px;
    padding-top: 1px;
    color: #748078;
    font-size: 8.5px;
    line-height: 1.55;
}

.range-state-stack {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}

.range-template-badge {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 0 8px;
    border: 1px solid #d1e8d6;
    border-radius: 999px;
    background: #f0f9f2;
    color: #347b49;
    font-size: 8px;
    font-weight: 800;
    white-space: nowrap;
}

.simple-threshold-row {
    transition:
        border-color .16s ease,
        background-color .16s ease,
        box-shadow .16s ease;
}

.simple-threshold-row.threshold-dirty {
    border-color: rgba(67, 139, 87, .32);
    box-shadow:
        0 0 0 2px rgba(67, 139, 87, .035);
}

.simple-threshold-row.template-preview {
    background:
        linear-gradient(
            90deg,
            rgba(245, 251, 246, .96),
            #fff 35%
        );
}

#saveAllThresholdsBtn:disabled {
    cursor: not-allowed;
    opacity: .52;
}

.operations-stats {
    margin-top: 14px;
}

@media (max-width: 900px) {
    .threshold-priority-head {
        align-items: stretch;
    }

    .threshold-priority-head select {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .crop-template-bar {
        grid-template-columns: 1fr 1fr;
    }

    .crop-template-field,
    .crop-template-summary {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .crop-template-bar {
        grid-template-columns: 1fr;
    }

    .crop-template-field,
    .crop-template-summary {
        grid-column: auto;
    }

    .crop-template-bar > button {
        width: 100%;
    }
}

/* v50 · grouped threshold workspace + bottom rule summary */
.threshold-priority-panel {
    padding: 18px;
    border-color: rgba(67, 125, 82, .16);
    border-radius: 15px;
    background:
        linear-gradient(
            180deg,
            rgba(249, 252, 249, .985),
            rgba(255, 255, 255, .99)
        );
    box-shadow:
        0 12px 30px rgba(35, 65, 43, .035);
}

.threshold-priority-panel::before {
    width: 2px;
    background:
        linear-gradient(
            180deg,
            rgba(48, 139, 74, .82),
            rgba(48, 139, 74, .06)
        );
}

.threshold-priority-head {
    padding-bottom: 13px;
    border-bottom: 1px solid rgba(70, 99, 78, .09);
}

.threshold-priority-head h2 {
    margin-bottom: 3px;
}

.threshold-priority-head select {
    min-height: 38px;
    min-width: 300px;
    border-color: #d5e0d7;
    background: rgba(255, 255, 255, .92);
}

.crop-template-bar {
    grid-template-columns:
        minmax(300px, 1fr)
        auto
        auto;
    margin-top: 12px;
    padding: 10px;
    border-color: rgba(69, 127, 84, .12);
    border-radius: 10px;
    background:
        linear-gradient(
            90deg,
            rgba(244, 249, 245, .96),
            rgba(249, 252, 249, .9)
        );
}

.crop-template-summary {
    color: #7b877f;
}

.simple-threshold-guide {
    gap: 6px 12px;
    margin-top: 10px;
    padding: 8px 10px;
    border-color: rgba(74, 130, 88, .11);
    background: rgba(247, 251, 248, .78);
}

.simple-threshold-guide em {
    flex: 1 1 320px;
    text-align: right;
}

.threshold-section-caption {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    padding: 0 2px 8px;
}

.threshold-section-caption > div {
    min-width: 0;
}

.threshold-section-caption strong {
    display: block;
    color: #2f4937;
    font-size: 12px;
    font-weight: 850;
}

.threshold-section-caption span {
    color: #7b877f;
    font-size: 8.5px;
}

.threshold-section-caption > div > span {
    display: block;
    margin-top: 3px;
}

.threshold-device-caption {
    flex: 0 0 auto;
    max-width: 42%;
    overflow: hidden;
    color: #5f7065 !important;
    font-weight: 720;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.simple-threshold-list {
    display: grid;
    gap: 10px;
    margin-top: 0;
}

.threshold-sensor-group {
    overflow: hidden;
    border: 1px solid rgba(79, 106, 87, .13);
    border-radius: 12px;
    background: rgba(252, 253, 252, .94);
}

.threshold-group-head {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 12px;
    border: 0;
    border-radius: 0;
    background:
        linear-gradient(
            90deg,
            rgba(244, 249, 245, .98),
            rgba(249, 251, 249, .88)
        );
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.threshold-group-head:hover {
    background:
        linear-gradient(
            90deg,
            rgba(239, 247, 241, .98),
            rgba(248, 251, 249, .94)
        );
}

.threshold-group-title-wrap {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 7px;
}

.threshold-group-kicker {
    color: #7f8d83;
    font-size: 7px;
    font-weight: 800;
    letter-spacing: .08em;
}

.threshold-group-title-wrap strong {
    overflow: hidden;
    color: #2d4735;
    font-size: 11.5px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.threshold-group-count {
    display: inline-flex;
    min-height: 19px;
    align-items: center;
    padding: 0 6px;
    border-radius: 999px;
    background: #eef4ef;
    color: #66756b;
    font-size: 7.5px;
    font-weight: 760;
    white-space: nowrap;
}

.threshold-group-head-side {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.threshold-group-configured {
    color: #65736a;
    font-size: 8px;
    font-weight: 760;
}

.threshold-group-toggle-label {
    min-width: 30px;
    color: #2f7d48;
    font-size: 8px;
    font-weight: 820;
    text-align: right;
}

.threshold-group-body {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding: 10px;
    border-top: 1px solid rgba(77, 104, 84, .09);
}

.threshold-sensor-group.is-open .threshold-group-body {
    display: grid;
}

.simple-threshold-row {
    min-width: 0;
    padding: 11px;
    border-color: rgba(78, 105, 85, .12);
    border-radius: 10px;
    background: rgba(255, 255, 255, .98);
    box-shadow: none;
}

.simple-threshold-row:hover {
    border-color: rgba(61, 124, 78, .18);
}

.simple-threshold-title {
    align-items: center;
}

.threshold-sensor-copy {
    min-width: 0;
}

.threshold-sensor-copy strong {
    display: block;
    overflow: hidden;
    color: #34473b;
    font-size: 10.5px;
    font-weight: 820;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.threshold-sensor-meta {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.threshold-sensor-meta code {
    max-width: 220px;
    overflow: hidden;
    padding: 2px 5px;
    border: 1px solid #e4eae5;
    border-radius: 5px;
    background: #f7f9f7;
    color: #7c8880;
    font-family: inherit;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.threshold-sensor-meta em {
    color: #87928a;
    font-size: 7.5px;
    font-style: normal;
    white-space: nowrap;
}

.range-state,
.range-template-badge {
    min-height: 20px;
    padding: 0 7px;
    font-size: 7px;
}

.simple-threshold-fields {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 52px;
    gap: 7px;
    margin-top: 9px;
}

.simple-threshold-fields label {
    min-width: 0;
    font-size: 8px;
}

.simple-threshold-fields label > span:first-child {
    display: block;
    margin-bottom: 4px;
}

.simple-input-wrap {
    margin-top: 0;
    border-color: #d4ddd6;
    border-radius: 7px;
}

.simple-input-wrap input {
    min-height: 32px;
    padding: 0 8px;
    font-size: 9px;
}

.simple-input-wrap i {
    padding: 0 7px;
    font-size: 7px;
}

.save-simple-threshold {
    min-height: 32px;
    padding: 0 9px;
    border-radius: 7px;
    font-size: 8px;
}

.simple-threshold-row.threshold-dirty {
    border-color: rgba(55, 139, 78, .30);
    box-shadow: inset 0 0 0 1px rgba(55, 139, 78, .035);
}

.simple-threshold-row.template-preview {
    background:
        linear-gradient(
            135deg,
            rgba(244, 251, 246, .98),
            rgba(255, 255, 255, .98) 48%
        );
}

.threshold-rule-summary-card {
    margin-top: 14px;
    padding: 13px;
    border: 1px solid rgba(73, 111, 82, .14);
    border-radius: 12px;
    background:
        linear-gradient(
            180deg,
            rgba(247, 251, 248, .96),
            rgba(252, 253, 252, .98)
        );
}

.rule-summary-empty {
    padding: 10px;
    color: #849088;
    font-size: 9px;
    text-align: center;
}

.rule-summary-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.rule-summary-kicker {
    display: block;
    margin-bottom: 2px;
    color: #4b8d5d;
    font-size: 7px;
    font-weight: 850;
    letter-spacing: .09em;
}

.rule-summary-head h3 {
    margin: 0;
    color: #2e4736;
    font-size: 12px;
    font-weight: 860;
}

.rule-summary-head p {
    margin: 3px 0 0;
    color: #7e8a82;
    font-size: 8px;
}

.rule-summary-stats {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}

.rule-summary-stats > span {
    display: grid;
    min-width: 62px;
    min-height: 42px;
    place-items: center;
    align-content: center;
    padding: 5px 8px;
    border: 1px solid rgba(79, 106, 87, .10);
    border-radius: 8px;
    background: rgba(255, 255, 255, .72);
    color: #758078;
    font-size: 7px;
}

.rule-summary-stats b {
    color: #345941;
    font-size: 12px;
    line-height: 1;
}

.rule-summary-stats > span.pending {
    border-color: rgba(56, 140, 79, .18);
    background: #f0f8f2;
    color: #3c7e4e;
}

.rule-summary-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 11px;
}

.rule-summary-group {
    min-width: 0;
    padding: 9px;
    border: 1px solid rgba(78, 106, 86, .10);
    border-radius: 9px;
    background: rgba(255, 255, 255, .74);
}

.rule-summary-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(81, 107, 89, .08);
}

.rule-summary-group-head strong {
    overflow: hidden;
    color: #405348;
    font-size: 9px;
    font-weight: 820;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rule-summary-group-head span {
    flex: 0 0 auto;
    color: #849088;
    font-size: 7px;
}

.rule-summary-group-rules {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
}

.rule-summary-pill {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 3px 7px;
    border: 1px solid #e0e6e1;
    border-radius: 999px;
    background: #f7f9f7;
    color: #7a857e;
    font-size: 7px;
}

.rule-summary-pill b,
.rule-summary-pill em {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rule-summary-pill b {
    max-width: 110px;
    color: #5d6c62;
    font-weight: 760;
}

.rule-summary-pill em {
    max-width: 120px;
    color: #77837b;
    font-style: normal;
}

.rule-summary-pill.configured {
    border-color: #d5e7d9;
    background: #f3f9f4;
}

.rule-summary-pill.configured em {
    color: #347a49;
    font-weight: 760;
}

.rule-summary-pill.pending {
    box-shadow: inset 0 0 0 1px rgba(50, 139, 76, .11);
}

.simple-threshold-message {
    margin-top: 8px;
}

@media (max-width: 1180px) {
    .threshold-group-body,
    .rule-summary-groups {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .threshold-priority-panel {
        padding: 14px;
    }

    .simple-threshold-guide em {
        flex-basis: 100%;
        text-align: left;
    }

    .threshold-section-caption {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .threshold-device-caption {
        max-width: 100%;
    }

    .rule-summary-head {
        flex-direction: column;
    }

    .rule-summary-stats {
        width: 100%;
    }

    .rule-summary-stats > span {
        flex: 1 1 0;
    }
}

@media (max-width: 620px) {
    .threshold-group-kicker,
    .threshold-group-configured {
        display: none;
    }

    .threshold-group-body {
        padding: 8px;
    }

    .simple-threshold-fields {
        grid-template-columns: 1fr;
    }

    .save-simple-threshold {
        width: 100%;
    }

    .rule-summary-stats {
        flex-wrap: wrap;
    }

    .rule-summary-stats > span {
        min-width: calc(50% - 3px);
    }
}



/* v51 · threshold field legibility + input polish */
.threshold-section-caption strong {
    font-size: 13px;
    letter-spacing: -.01em;
}

.threshold-section-caption span,
.threshold-device-caption {
    color: #66756b !important;
    font-size: 9.5px;
    line-height: 1.5;
}

.threshold-group-kicker {
    color: #6f7f75;
    font-size: 8px;
}

.threshold-group-title-wrap strong {
    font-size: 12.5px;
    letter-spacing: -.005em;
}

.threshold-group-count,
.threshold-group-configured,
.threshold-group-toggle-label {
    font-size: 8.5px;
}

.threshold-group-count {
    min-height: 21px;
    padding: 0 7px;
    background: #edf4ef;
    color: #5f7065;
}

.threshold-group-configured {
    color: #5e6f64;
}

.threshold-group-toggle-label {
    color: #267542;
}

.threshold-sensor-copy strong {
    color: #2f4436;
    font-size: 11.5px;
    line-height: 1.35;
}

.threshold-sensor-meta {
    gap: 7px;
    margin-top: 5px;
}

.threshold-sensor-meta code {
    max-width: 260px;
    padding: 3px 6px;
    border-color: #dbe4dd;
    border-radius: 6px;
    background: #f4f7f4;
    color: #65736a;
    font-size: 8px;
    line-height: 1.25;
}

.threshold-sensor-meta em {
    color: #66746b;
    font-size: 8.5px;
    font-weight: 700;
}

.range-state,
.range-template-badge {
    min-height: 22px;
    padding: 0 8px;
    font-size: 8px;
    font-weight: 780;
}

.range-state.idle {
    border-color: #dfe5e0;
    background: #f2f4f2;
    color: #717b74;
}

.range-state.active {
    border-color: #cee4d3;
    background: #edf7ef;
    color: #2f7c47;
}

.range-template-badge {
    border-color: #cce3d1;
    background: #eef8f0;
    color: #2f7946;
}

.simple-threshold-fields {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 62px;
    gap: 9px;
    margin-top: 11px;
}

.simple-threshold-fields label {
    color: #44564a;
    font-size: 9.5px;
    font-weight: 760;
    line-height: 1.35;
}

.simple-threshold-fields label > span:first-child {
    margin-bottom: 6px;
}

.simple-input-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 38px;
    overflow: hidden;
    border: 1px solid #cbd8ce;
    border-radius: 9px;
    background: #fff;
    box-shadow:
        inset 0 1px 1px rgba(35, 59, 42, .02),
        0 1px 2px rgba(35, 59, 42, .025);
    transition:
        border-color .16s ease,
        box-shadow .16s ease,
        background-color .16s ease;
}

.simple-input-wrap:hover {
    border-color: #b9cbbd;
}

.simple-input-wrap:focus-within {
    border-color: #62a977;
    background: #fff;
    box-shadow:
        0 0 0 3px rgba(62, 151, 88, .10),
        0 1px 2px rgba(35, 59, 42, .03);
}

.simple-input-wrap input {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 0 11px;
    border: 0 !important;
    outline: 0;
    background: transparent !important;
    color: #273c2e;
    font-size: 10.5px;
    font-weight: 660;
    line-height: 38px;
    box-shadow: none !important;
}

.simple-input-wrap input::placeholder {
    color: #9aa59e;
    font-weight: 560;
    opacity: 1;
}

.simple-input-wrap i {
    display: inline-flex;
    min-width: 34px;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    border-left: 1px solid #e2e8e3;
    background: #f7f9f7;
    color: #5e6f64;
    font-size: 8.5px;
    font-weight: 760;
    font-style: normal;
    white-space: nowrap;
}

.simple-input-wrap:focus-within i {
    border-left-color: #d4e4d8;
    background: #f3f8f4;
    color: #34784a;
}

.save-simple-threshold {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 9px;
    font-size: 9px;
    font-weight: 800;
    box-shadow: 0 2px 5px rgba(40, 116, 63, .10);
}

.crop-template-field label {
    margin-bottom: 6px;
    color: #4e6054;
    font-size: 9.5px;
    font-weight: 790;
}

.crop-template-field select,
.threshold-priority-head select {
    min-height: 40px;
    border: 1px solid #cbd8ce;
    border-radius: 9px;
    background: #fff;
    color: #304238;
    font-size: 10px;
    font-weight: 650;
    box-shadow: inset 0 1px 1px rgba(35, 59, 42, .018);
}

.crop-template-field select:hover,
.threshold-priority-head select:hover {
    border-color: #b9cbbd;
}

.crop-template-field select:focus,
.threshold-priority-head select:focus {
    border-color: #62a977;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(62, 151, 88, .10);
}

.crop-template-summary,
.simple-threshold-guide,
.simple-threshold-guide em {
    color: #64736a;
    font-size: 9px;
    line-height: 1.55;
}

.simple-threshold-guide strong {
    color: #3f5947;
    font-size: 9.5px;
}

.simple-threshold-guide span {
    color: #526258;
    font-size: 9px;
}

.rule-summary-head p {
    color: #66756b;
    font-size: 9px;
}

.rule-summary-group-head strong {
    color: #394f40;
    font-size: 9.5px;
}

.rule-summary-group-head span {
    color: #6e7b72;
    font-size: 8px;
}

.rule-summary-pill {
    min-height: 26px;
    padding: 4px 8px;
    font-size: 8px;
}

@media (max-width: 620px) {
    .simple-threshold-fields {
        grid-template-columns: 1fr;
    }

    .simple-input-wrap,
    .simple-input-wrap input,
    .simple-input-wrap i,
    .save-simple-threshold {
        min-height: 40px;
    }
}


/* v52 · one-click crop alert presets */
.crop-preset-panel {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(70, 127, 84, .13);
    border-radius: 11px;
    background: linear-gradient(180deg, rgba(248,251,248,.97), rgba(252,253,252,.96));
}

.crop-preset-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.crop-preset-kicker {
    display: block;
    margin-bottom: 3px;
    color: #3d8953;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .09em;
}

.crop-preset-head strong {
    display: block;
    color: #2f4736;
    font-size: 11.5px;
    font-weight: 850;
}

.crop-preset-head p,
.crop-preset-scope {
    color: #68766d;
    font-size: 9px;
    line-height: 1.5;
}

.crop-preset-head p {
    margin: 3px 0 0;
}

.crop-preset-scope {
    flex: 0 0 auto;
}

.crop-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.crop-preset-card {
    display: grid;
    gap: 4px;
    min-height: 82px;
    padding: 10px 11px;
    border: 1px solid #d9e3db;
    border-radius: 10px;
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(37,61,44,.02);
    transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.crop-preset-card:hover {
    border-color: #bcd2c1;
    background: #fbfdfb;
    box-shadow: 0 5px 14px rgba(41,78,51,.055);
    transform: translateY(-1px);
}

.crop-preset-card.is-active {
    border-color: #71b083;
    background: linear-gradient(145deg, #edf8f0, #fbfdfb 72%);
    box-shadow: 0 0 0 2px rgba(59,145,83,.065);
}

.crop-preset-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.crop-preset-card-top strong {
    color: #2d5539;
    font-size: 12px;
    font-weight: 860;
}

.crop-preset-card-top em {
    padding: 2px 6px;
    border-radius: 999px;
    background: #f0f5f1;
    color: #718078;
    font-size: 7.5px;
    font-style: normal;
    font-weight: 760;
}

.crop-preset-card.is-active .crop-preset-card-top em {
    background: #dff1e4;
    color: #2e7d47;
}

.crop-preset-card-name {
    color: #5a6a60;
    font-size: 8.5px;
    font-weight: 740;
}

.crop-preset-card-brief {
    overflow: hidden;
    color: #738078;
    font-size: 8px;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crop-template-bar { margin-top: 8px; }

@media (max-width: 900px) {
    .crop-preset-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }
    .crop-preset-grid { grid-template-columns: 1fr; }
    .crop-preset-card { min-height: 72px; }
}


/* v53 · crop presets are suggestion-only, never auto-filled values */
.crop-preset-card-top em {
    min-width: 52px;
    text-align: center;
}

.simple-threshold-row.template-suggestion {
    border-color: rgba(75, 129, 89, .18);
}

.simple-threshold-row.template-suggestion .simple-input-wrap {
    border-color: #c9d8cc;
}

.simple-threshold-row.template-suggestion .simple-input-wrap input::placeholder {
    color: #5e906c;
    font-weight: 700;
}

.simple-threshold-row.template-suggestion .simple-input-wrap i {
    background: #f5f9f6;
}

.simple-threshold-row.template-suggestion .range-template-badge {
    border-color: #cee4d3;
    background: #edf7ef;
    color: #347a49;
}

.crop-template-summary {
    min-height: 20px;
}

/* v54 · align Operations threshold workspace with Environment Overview
 * Larger type, calmer cards, softer depth, and consistent 16–17px radii.
 */

/* Overall hierarchy */
.threshold-priority-kicker,
.crop-preset-kicker {
    font-size: 9px;
    line-height: 1.4;
}

.threshold-priority-head h2 {
    color: #2b4132;
    font-size: 21px;
    font-weight: 860;
    letter-spacing: -.025em;
}

.threshold-priority-head .muted {
    margin-top: 5px;
    color: #69776d;
    font-size: 11px;
    line-height: 1.55;
}

.threshold-section-caption {
    margin-top: 22px;
    padding: 0 3px 10px;
}

.threshold-section-caption strong {
    color: #2e4434;
    font-size: 15px;
    font-weight: 850;
}

.threshold-section-caption span,
.threshold-device-caption {
    margin-top: 4px;
    color: #6b786f !important;
    font-size: 10.5px;
    line-height: 1.5;
}

/* Preset area: same card language as Dashboard cards */
.crop-preset-panel {
    padding: 15px;
    border: 1px solid #dbe8dc;
    border-radius: 16px;
    background:
        linear-gradient(
            145deg,
            #ffffff 0%,
            #f4f8f4 100%
        );
    box-shadow:
        0 8px 24px
        rgba(25, 72, 42, .045);
}

.crop-preset-head strong {
    color: #304737;
    font-size: 14px;
    font-weight: 850;
}

.crop-preset-head p,
.crop-preset-scope {
    color: #6d7a71;
    font-size: 10px;
}

.crop-preset-grid {
    gap: 11px;
    margin-top: 13px;
}

.crop-preset-card {
    min-height: 98px;
    padding: 14px 15px;
    border: 1px solid #dfe8e0;
    border-radius: 16px;
    background: #fff;
    box-shadow:
        0 8px 24px
        rgba(25, 72, 42, .045);
}

.crop-preset-card:hover {
    border-color: #cbdcce;
    background:
        linear-gradient(
            145deg,
            #ffffff 0%,
            #f7faf7 100%
        );
    box-shadow:
        0 10px 26px
        rgba(25, 72, 42, .065);
    transform: translateY(-1px);
}

.crop-preset-card.is-active {
    border-color: #b8d7bf;
    background:
        linear-gradient(
            145deg,
            #ffffff 0%,
            #eef7f0 100%
        );
    box-shadow:
        0 8px 24px
        rgba(25, 72, 42, .055);
}

.crop-preset-card-top strong {
    color: #294f35;
    font-size: 15px;
    font-weight: 860;
}

.crop-preset-card-top em {
    min-height: 23px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef5f0;
    color: #5f7065;
    font-size: 8.5px;
}

.crop-preset-card.is-active .crop-preset-card-top em {
    background: #e1f1e5;
    color: #277743;
}

.crop-preset-card-name {
    color: #526358;
    font-size: 10px;
    font-weight: 780;
}

.crop-preset-card-brief {
    color: #6c7a71;
    font-size: 9.5px;
    line-height: 1.5;
}

/* Secondary template row */
.crop-template-bar {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid #dfe8e0;
    border-radius: 14px;
    background: rgba(250, 252, 250, .94);
}

.crop-template-field label {
    color: #44584b;
    font-size: 10.5px;
}

.crop-template-field select,
.threshold-priority-head select {
    min-height: 44px;
    border-radius: 11px;
    font-size: 11.5px;
}

.crop-template-summary {
    color: #66756b;
    font-size: 10px;
    line-height: 1.6;
}

/* Configuration guide */
.simple-threshold-guide {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 12px;
}

.simple-threshold-guide strong {
    color: #3c5543;
    font-size: 10.5px;
}

.simple-threshold-guide span,
.simple-threshold-guide em {
    color: #5f6f64;
    font-size: 10px;
}

/* Sensor group: same calm outer container language */
.threshold-sensor-group {
    border: 1px solid #dbe6dc;
    border-radius: 16px;
    background:
        rgba(250, 252, 250, .96);
    box-shadow:
        0 6px 20px
        rgba(25, 72, 42, .035);
}

.threshold-group-head {
    min-height: 58px;
    padding: 11px 15px;
    background:
        linear-gradient(
            145deg,
            #ffffff 0%,
            #f4f8f4 100%
        );
}

.threshold-group-title-wrap {
    gap: 9px;
}

.threshold-group-kicker {
    color: #77857c;
    font-size: 8.5px;
}

.threshold-group-title-wrap strong {
    color: #2d4434;
    font-size: 14px;
    font-weight: 850;
}

.threshold-group-count {
    min-height: 23px;
    padding: 0 8px;
    font-size: 9px;
}

.threshold-group-configured,
.threshold-group-toggle-label {
    font-size: 9.5px;
}

.threshold-group-toggle-label {
    color: #257440;
    font-weight: 820;
}

.threshold-group-body {
    gap: 12px;
    padding: 12px;
    border-top-color: #e1e9e2;
}

/* Threshold cards: mirror Dashboard sensor-card */
.simple-threshold-row {
    padding: 14px 15px;
    border: 1px solid #dfe8e0;
    border-radius: 16px;
    background: #fff;
    box-shadow:
        0 8px 24px
        rgba(25, 72, 42, .045);
}

.simple-threshold-row:hover {
    border-color: #d2e0d4;
    box-shadow:
        0 10px 26px
        rgba(25, 72, 42, .055);
}

.threshold-sensor-copy strong {
    color: #2f4436;
    font-size: 13px;
    font-weight: 850;
    line-height: 1.4;
}

.threshold-sensor-meta {
    margin-top: 6px;
}

.threshold-sensor-meta code {
    padding: 4px 7px;
    border-color: #e0e7e1;
    background: #f6f8f6;
    color: #65736a;
    font-size: 9px;
}

.threshold-sensor-meta em {
    color: #65736a;
    font-size: 9.5px;
}

.range-state,
.range-template-badge {
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 9px;
}

/* Inputs: larger, quieter, more readable */
.simple-threshold-fields {
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr)
        66px;
    gap: 10px;
    margin-top: 13px;
}

.simple-threshold-fields label {
    color: #3f5146;
    font-size: 11px;
    font-weight: 780;
}

.simple-threshold-fields label > span:first-child {
    margin-bottom: 7px;
}

.simple-input-wrap {
    min-height: 43px;
    border-color: #cbd8ce;
    border-radius: 11px;
    box-shadow:
        inset 0 1px 1px
        rgba(35, 59, 42, .018);
}

.simple-input-wrap input {
    min-height: 43px;
    padding: 0 12px;
    color: #293c30;
    font-size: 12px;
    font-weight: 680;
    line-height: 43px;
}

.simple-input-wrap input::placeholder {
    color: #8d9a91;
    font-size: 11px;
    font-weight: 600;
}

.simple-threshold-row.template-suggestion
.simple-input-wrap input::placeholder {
    color: #47845a;
    font-weight: 760;
}

.simple-input-wrap i {
    min-width: 39px;
    min-height: 43px;
    padding: 0 10px;
    color: #56675c;
    font-size: 9.5px;
    font-weight: 780;
}

.save-simple-threshold {
    min-height: 43px;
    padding: 0 13px;
    border-radius: 11px;
    font-size: 10px;
    font-weight: 820;
}

/* Rule summary follows the same Dashboard card surface */
.threshold-rule-summary-card {
    margin-top: 16px;
    padding: 15px;
    border: 1px solid #dbe8dc;
    border-radius: 16px;
    background:
        linear-gradient(
            145deg,
            #ffffff 0%,
            #f4f8f4 100%
        );
    box-shadow:
        0 8px 24px
        rgba(25, 72, 42, .04);
}

.rule-summary-kicker {
    font-size: 8.5px;
}

.rule-summary-head h3 {
    color: #2d4434;
    font-size: 14px;
}

.rule-summary-head p {
    color: #66756b;
    font-size: 10px;
}

.rule-summary-stats > span {
    min-width: 70px;
    min-height: 48px;
    border-radius: 10px;
    font-size: 8.5px;
}

.rule-summary-stats b {
    font-size: 14px;
}

.rule-summary-group {
    padding: 11px;
    border-color: #e0e8e1;
    border-radius: 11px;
}

.rule-summary-group-head strong {
    color: #3b5041;
    font-size: 10.5px;
}

.rule-summary-group-head span {
    color: #68776d;
    font-size: 9px;
}

.rule-summary-pill {
    min-height: 28px;
    padding: 4px 9px;
    font-size: 9px;
}

/* Keep responsive density sensible */
@media (max-width: 1180px) {
    .crop-preset-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }
}

@media (max-width: 760px) {
    .crop-preset-grid {
        grid-template-columns: 1fr;
    }

    .threshold-priority-head h2 {
        font-size: 19px;
    }

    .simple-threshold-fields {
        grid-template-columns: 1fr;
    }

    .simple-input-wrap,
    .simple-input-wrap input,
    .simple-input-wrap i,
    .save-simple-threshold {
        min-height: 44px;
    }
}



/* v55 · formalize crop reference copy and presentation */
.crop-preset-kicker {
    letter-spacing: .07em;
}

.crop-preset-head strong {
    letter-spacing: -.01em;
}

.crop-preset-card-top em {
    background: #f3f6f3;
    color: #5f6d63;
}

.crop-preset-card.is-active .crop-preset-card-top em {
    background: #e6f2e9;
    color: #2f7244;
}

.crop-template-summary {
    color: #627067;
}

.simple-threshold-row.template-suggestion .range-template-badge {
    background: #eef6f0;
    color: #35764a;
}

/* Current Crop Focus v56 */
.current-crop-focus-v56 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid #dce9df;
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(246, 251, 247, .98), rgba(255, 255, 255, .98));
    box-shadow: 0 8px 22px rgba(57, 89, 67, .045);
}

.current-crop-focus-main {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex: 0 0 auto;
}

.current-crop-focus-kicker {
    color: #6b786f;
    font-size: 12px;
    font-weight: 760;
    letter-spacing: .01em;
}

.current-crop-focus-main strong {
    color: #285f3a;
    font-size: 19px;
    font-weight: 860;
    line-height: 1.2;
}

.current-crop-focus-refs {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
    min-width: 0;
}

.current-crop-ref-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 29px;
    padding: 0 10px;
    border: 1px solid #dce9df;
    border-radius: 999px;
    background: rgba(255, 255, 255, .88);
    color: #607067;
    white-space: nowrap;
}

.current-crop-ref-chip b {
    color: #526158;
    font-size: 10px;
    font-weight: 760;
}

.current-crop-ref-chip em {
    color: #2f7d4a;
    font-size: 11px;
    font-style: normal;
    font-weight: 820;
    font-variant-numeric: tabular-nums;
}

.simple-threshold-row.has-crop-reference-v56 .simple-input-wrap input::placeholder {
    color: #7b9b84;
    opacity: 1;
}

@media (max-width: 860px) {
    .current-crop-focus-v56 {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
    .current-crop-focus-refs { justify-content: flex-start; }
}

@media (max-width: 620px) {
    .current-crop-focus-v56 { padding: 13px 14px; }
    .current-crop-focus-main { align-items: flex-start; flex-direction: column; gap: 3px; }
    .current-crop-focus-refs { display: grid; grid-template-columns: 1fr; width: 100%; }
    .current-crop-ref-chip { justify-content: space-between; width: 100%; }
}

/* v62 · crop strategy workspace -------------------------------------------------
 * One clear task flow: device -> current crop -> sensor thresholds -> summary.
 * The crop is a durable device context, edited only on demand.
 */
.threshold-priority-panel {
    padding: 20px;
    border-color: rgba(72, 112, 82, .14);
    border-radius: 18px;
    background: rgba(252, 253, 252, .96);
    box-shadow: 0 12px 34px rgba(31, 69, 42, .035);
}

.threshold-priority-panel::before {
    display: none;
}

.threshold-priority-head {
    align-items: flex-end;
    padding-bottom: 0;
    border-bottom: 0;
}

.threshold-priority-head h2 {
    margin: 0;
    color: #293f30;
    font-size: 22px;
    font-weight: 860;
    letter-spacing: -.025em;
}

.threshold-priority-head .muted {
    max-width: 620px;
    margin-top: 6px;
    color: #6b786f;
    font-size: 11px;
    line-height: 1.55;
}

.threshold-priority-head select {
    min-width: 320px;
    min-height: 44px;
    padding-left: 13px;
    border-color: #d4dfd6;
    border-radius: 12px;
    background-color: #fff;
    color: #34483a;
    font-size: 11.5px;
    font-weight: 720;
    box-shadow: 0 3px 10px rgba(36, 72, 46, .025);
}

/* Current crop: compact identity card with crop-specific inline SVG. */
.crop-context-card {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin-top: 14px;
    padding: 11px 13px;
    border: 1px solid #dce7de;
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(248, 251, 248, .98), rgba(255, 255, 255, .99) 68%);
    box-shadow: 0 5px 18px rgba(32, 73, 44, .028);
}

.crop-context-mark {
    --crop-icon: #2f8050;
    --crop-icon-fill: #dff1e4;
    --crop-icon-bg: #f0f7f2;
    --crop-icon-border: #d8e7dc;
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid var(--crop-icon-border);
    border-radius: 13px;
    background: var(--crop-icon-bg);
    color: var(--crop-icon);
}

.crop-context-mark[data-crop="cucumber"] {
    --crop-icon: #2f7d4b;
    --crop-icon-fill: #dcefe1;
    --crop-icon-bg: #eef7f0;
    --crop-icon-border: #d8e7dc;
}

.crop-context-mark[data-crop="tomato"] {
    --crop-icon: #a85248;
    --crop-icon-fill: #f5e5e2;
    --crop-icon-bg: #fbf3f1;
    --crop-icon-border: #ead8d5;
}

.crop-context-mark[data-crop="pepper"] {
    --crop-icon: #a95c39;
    --crop-icon-fill: #f5e8df;
    --crop-icon-bg: #fbf4ef;
    --crop-icon-border: #eadbd2;
}

.crop-context-mark[data-crop="strawberry"] {
    --crop-icon: #a54f5c;
    --crop-icon-fill: #f5e4e8;
    --crop-icon-bg: #fbf2f4;
    --crop-icon-border: #ead7dc;
}

.crop-context-mark[data-crop="eggplant"] {
    --crop-icon: #6d5b86;
    --crop-icon-fill: #ebe6f1;
    --crop-icon-bg: #f5f2f8;
    --crop-icon-border: #dfd8e8;
}

.crop-context-mark[data-crop="lettuce"] {
    --crop-icon: #4e7f4a;
    --crop-icon-fill: #e4efe1;
    --crop-icon-bg: #f1f7ef;
    --crop-icon-border: #dbe8d8;
}

.crop-context-mark[data-crop="empty"] {
    --crop-icon: #7b887f;
    --crop-icon-fill: #edf1ee;
    --crop-icon-bg: #f5f7f5;
    --crop-icon-border: #e0e6e1;
}

.crop-context-mark svg {
    width: 32px;
    height: 32px;
    overflow: visible;
}

.crop-context-mark .crop-library-icon {
    display: block;
    width: 18px;
    height: 39px;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.crop-context-mark[data-crop="cucumber"] {
    background: #f1f8f3;
}

.crop-context-mark .crop-icon-fill {
    fill: var(--crop-icon-fill);
    stroke: var(--crop-icon);
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crop-context-mark .crop-icon-line {
    fill: none;
    stroke: var(--crop-icon);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crop-context-mark .crop-icon-detail {
    fill: none;
    stroke: var(--crop-icon);
    stroke-width: 1.9;
    stroke-linecap: round;
}

.crop-context-body {
    min-width: 0;
}

.crop-context-kicker {
    display: block;
    margin-bottom: 3px;
    color: #718078;
    font-size: 10.5px;
    font-weight: 760;
    letter-spacing: .015em;
}

.crop-context-view strong {
    display: block;
    color: #263e2d;
    font-size: 22px;
    font-weight: 860;
    letter-spacing: -.025em;
    line-height: 1.18;
}

.crop-context-view strong.is-empty {
    color: #6f7c74;
}

.crop-context-change {
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid #d6e1d8;
    border-radius: 10px;
    background: #fff;
    color: #425d4a;
    font-size: 10.5px;
    font-weight: 760;
    white-space: nowrap;
    box-shadow: none;
}

.crop-context-change:hover {
    border-color: #b8cfbd;
    background: #f8fbf8;
    color: #2d7244;
}

.crop-context-editor {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.crop-context-editor[hidden] {
    display: none;
}

.crop-context-fields {
    display: grid;
    grid-template-columns: minmax(190px, 260px) minmax(190px, 280px);
    gap: 10px;
    min-width: 0;
}

.crop-context-fields label {
    display: block;
    min-width: 0;
}

.crop-context-fields label > span {
    display: block;
    margin-bottom: 5px;
    color: #526158;
    font-size: 9.5px;
    font-weight: 760;
}

.crop-context-fields select,
.crop-context-fields input {
    width: 100%;
    min-height: 40px;
    padding: 0 11px;
    border: 1px solid #cfdcd2;
    border-radius: 10px;
    background: #fff;
    color: #2f4235;
    font-size: 11px;
    font-weight: 680;
    outline: none;
}

.crop-context-fields select:focus,
.crop-context-fields input:focus {
    border-color: #7fb18c;
    box-shadow: 0 0 0 3px rgba(54, 135, 76, .08);
}

.crop-context-edit-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 7px;
}

.crop-context-edit-actions button {
    min-height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 790;
}

/* Threshold section: move the bulk save action next to the task it controls. */
.threshold-section-caption {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding: 0 2px 9px;
}

.threshold-section-caption strong {
    color: #2c4333;
    font-size: 15px;
    font-weight: 860;
}

.threshold-section-caption > div > span {
    margin-top: 4px;
    color: #748078;
    font-size: 10px;
}

.threshold-section-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.threshold-section-actions .threshold-device-caption {
    display: block;
    max-width: 310px;
    margin: 0;
    overflow: hidden;
    color: #718078 !important;
    font-size: 9.5px;
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#saveAllThresholdsBtn {
    min-height: 38px;
    padding: 0 13px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 820;
    white-space: nowrap;
}

/* Group container carries the hierarchy; inner sensor cards stay quiet. */
.threshold-sensor-group {
    overflow: hidden;
    border: 1px solid #dbe5dd;
    border-radius: 16px;
    background: #f8fbf8;
    box-shadow: none;
}

.threshold-group-head {
    min-height: 56px;
    padding: 11px 14px;
    background: linear-gradient(180deg, #fbfdfb, #f6faf7);
}

.threshold-group-kicker {
    display: none;
}

.threshold-group-title-wrap {
    gap: 8px;
}

.threshold-group-title-wrap strong {
    color: #2e4434;
    font-size: 13.5px;
    font-weight: 850;
}

.threshold-group-count {
    min-height: 22px;
    padding: 0 7px;
    border-color: #dce7de;
    background: rgba(255, 255, 255, .8);
    color: #718078;
    font-size: 8.5px;
}

.threshold-group-configured,
.threshold-group-toggle-label {
    font-size: 9px;
}

.threshold-group-body {
    gap: 10px;
    padding: 10px;
    border-top-color: #e3ebe4;
    background: rgba(248, 251, 248, .72);
}

.simple-threshold-row {
    padding: 13px 14px;
    border: 1px solid #e0e8e1;
    border-radius: 13px;
    background: rgba(255, 255, 255, .96);
    box-shadow: none;
}

.simple-threshold-row:hover {
    border-color: #d3dfd5;
    box-shadow: none;
}

.simple-threshold-row.threshold-dirty {
    border-color: #b8d6bf;
    background: linear-gradient(145deg, #ffffff, #f7fbf8);
    box-shadow: inset 3px 0 0 rgba(54, 139, 78, .62);
}

.threshold-sensor-copy strong {
    font-size: 12.5px;
}

.threshold-sensor-meta {
    margin-top: 5px;
}

.threshold-sensor-meta code {
    padding: 3px 6px;
    background: #f5f7f5;
    color: #6c786f;
    font-size: 8.5px;
}

.threshold-sensor-meta em {
    font-size: 9px;
}

.range-state {
    min-height: 23px;
    padding: 0 8px;
    font-size: 8.5px;
}

.range-template-badge {
    display: none !important;
}

.simple-threshold-fields {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 66px;
    gap: 9px;
    margin-top: 12px;
}

.simple-threshold-fields label {
    color: #46574c;
    font-size: 10.5px;
}

.simple-threshold-fields label > span:first-child {
    margin-bottom: 6px;
}

.simple-input-wrap {
    min-height: 42px;
    border-color: #ced9d0;
    border-radius: 10px;
    background: #fff;
}

.simple-input-wrap:focus-within {
    border-color: #7fb18c;
    box-shadow: 0 0 0 3px rgba(54, 135, 76, .07);
}

.simple-input-wrap input {
    min-height: 42px;
    padding: 0 11px;
    color: #293d30;
    font-size: 11.5px;
    line-height: 42px;
}

.simple-input-wrap input::placeholder {
    color: #929d95;
    font-size: 10.5px;
    font-weight: 580;
}

.simple-input-wrap i {
    min-width: 38px;
    min-height: 42px;
    padding: 0 9px;
    border-left: 1px solid #edf1ed;
    background: #fafcfa;
    color: #66746b;
    font-size: 9px;
}

.save-simple-threshold {
    min-height: 42px;
    border-radius: 10px;
}

.threshold-rule-summary-card {
    margin-top: 14px;
    padding: 14px;
    border-color: #dce6de;
    border-radius: 16px;
    background: linear-gradient(145deg, #ffffff, #f7faf7);
    box-shadow: none;
}

.rule-summary-head p {
    color: #748078;
}

@media (max-width: 980px) {
    .threshold-priority-head {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .threshold-priority-head select {
        width: 100%;
        min-width: 0;
    }

    .crop-context-card {
        grid-template-columns: 46px minmax(0, 1fr);
    }

    .crop-context-change {
        grid-column: 2;
        justify-self: start;
    }

    .crop-context-editor {
        align-items: stretch;
        flex-direction: column;
    }

    .crop-context-edit-actions {
        justify-content: flex-end;
    }
}

@media (max-width: 760px) {
    .threshold-priority-panel {
        padding: 15px;
        border-radius: 15px;
    }

    .threshold-priority-head h2 {
        font-size: 19px;
    }

    .crop-context-card {
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 10px;
        padding: 11px 12px;
        border-radius: 14px;
    }

    .crop-context-mark {
        width: 46px;
        height: 46px;
        border-radius: 13px;
    }

    .crop-context-mark svg {
        width: 32px;
        height: 32px;
    }

    .crop-context-mark .crop-library-icon {
        width: 17px;
        height: 37px;
    }

    .crop-context-view strong {
        font-size: 20px;
    }

    .crop-context-fields {
        grid-template-columns: 1fr;
    }

    .crop-context-change {
        grid-column: 1 / -1;
        width: 100%;
    }

    .crop-context-edit-actions button {
        flex: 1 1 0;
    }

    .threshold-section-caption {
        align-items: stretch;
        flex-direction: column;
        gap: 9px;
    }

    .threshold-section-actions {
        justify-content: space-between;
    }

    .threshold-section-actions .threshold-device-caption {
        max-width: 55%;
    }

    .simple-threshold-fields {
        grid-template-columns: 1fr;
    }

    .save-simple-threshold {
        width: 100%;
    }
}
