/* Scenario action editor: consistent fields and clear grouping. */
.automation-shell .automation-action-row {
    padding: 16px;
    gap: 12px;
    border: 1px solid #e4ebf3;
    background: #f6f8fb;
    border-radius: 14px;
}
.automation-shell .automation-rule-list { gap: 12px; }
.automation-shell .automation-action-row > .automation-rule-index {
    margin-top: 7px;
    background: #e3ebf4;
    color: #536781;
}
.automation-shell .automation-action-row > .automation-remove { margin-top: 3px; }
.automation-shell .automation-action-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    color: #1e293b;
    font-size: 14px;
}
.automation-shell .automation-field {
    display: grid;
    min-width: 0;
    gap: 6px;
    margin: 0;
    align-content: start;
}
.automation-shell .automation-field > span {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: #64748b;
}
.automation-shell .automation-action-fields > .automation-field {
    grid-template-columns: 110px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e9f2;
}
.automation-shell .automation-action-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
    min-width: 0;
}
.automation-shell .automation-action-content--set_value,
.automation-shell .automation-action-content--smart_switch,
.automation-shell .automation-action-content--t5_relay,
.automation-shell .automation-action-content--notification {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.automation-shell .automation-action-group {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
    min-width: 0;
}
.automation-shell .automation-action-fields input:not([type=checkbox]),
.automation-shell .automation-action-fields select {
    height: 42px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 11px;
    border: 1px solid #cfdae7;
    border-radius: 10px;
    background: #fff;
    color: #24354b;
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.automation-shell .automation-action-fields input:focus,
.automation-shell .automation-action-fields select:focus {
    outline: none;
    border-color: #398f86;
    box-shadow: 0 0 0 3px #0f766e15;
}
.automation-shell input[type=checkbox] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    flex: 0 0 18px;
    padding: 0;
    margin: 0;
    accent-color: #0f766e;
}
.automation-shell .automation-check-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 42px;
    margin: 0;
    padding: 8px 12px;
    box-sizing: border-box;
    border: 1px solid #d7e5e2;
    border-radius: 10px;
    background: #eef7f4;
    cursor: pointer;
}
.automation-shell .automation-check-field span { min-width: 0; }
.automation-shell .automation-check-field strong,
.automation-shell .automation-check-field small { display: block; }
.automation-shell .automation-check-field strong {
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
    color: #28554d;
}
.automation-shell .automation-check-field small {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.35;
    color: #65827a;
}
.automation-shell .automation-action-note {
    grid-column: 1 / -1;
    margin: 0;
    padding: 11px 13px;
    border: 1px solid #e1e9f2;
    border-radius: 10px;
    background: #edf3f9;
    color: #60738b;
    font-size: 12px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}
.automation-shell .automation-action-content--heating_visit {
    grid-template-columns: minmax(0, 1fr) auto;
}
.automation-shell .automation-settings-link { display: flex; align-items: end; }
.automation-shell .automation-secondary-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 15px;
    border: 1px solid #c9d8e3;
    border-radius: 10px;
    background: #fff;
    color: #315268;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}
.automation-shell .automation-secondary-button:hover {
    border-color: #86aaa7;
    background: #f0f8f6;
}
@media (max-width: 960px) {
    .automation-shell .automation-action-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .automation-shell .automation-action-group > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .automation-shell .automation-action-row {
        grid-template-columns: 24px minmax(0, 1fr) 32px;
        padding: 12px;
        gap: 10px;
    }
    .automation-shell .automation-action-row > .automation-rule-index,
    .automation-shell .automation-action-row > .automation-remove { margin-top: 0; }
    .automation-shell .automation-action-row > .automation-rule-index { grid-column: 1; grid-row: 1; }
    .automation-shell .automation-action-row > .automation-remove { grid-column: 3; grid-row: 1; }
    .automation-shell .automation-action-fields { grid-column: 1 / -1; grid-row: 2; gap: 14px; }
    .automation-shell .automation-action-fields > .automation-field {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
        padding-bottom: 12px;
    }
    .automation-shell .automation-action-content,
    .automation-shell .automation-action-group {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }
    .automation-shell .automation-settings-link > button { width: 100%; }
    .automation-shell .automation-check-field { padding: 11px 12px; }
    .automation-shell .automation-toolbar { flex-wrap: wrap; }
    .automation-shell .automation-editor-actions { flex-wrap: wrap; }
    .automation-shell .automation-editor-actions button { justify-content: center; flex: 1; }
}

/* Keep condition logic controls from squeezing section titles. */
.automation-shell .automation-section-title > div { min-width: 0; }
.automation-shell .automation-section-title > select {
    width: 180px;
    flex: 0 0 180px;
    box-sizing: border-box;
}
.automation-shell .automation-check-field { height: 42px; padding: 0 12px; }
@media (max-width: 760px) {
    .automation-shell .automation-section-title > select { width: 100%; flex: 1 0 100%; }
    .automation-shell .automation-check-field { height: auto; min-height: 56px; padding: 10px 12px; }
}

@media (max-width: 760px) {
    .automation-shell .automation-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
    .automation-shell .automation-tabs button { justify-content: center; min-width: 0; }
}
