.alerts-page { max-width:1200px; margin:0 auto; padding:24px 0 110px; color:var(--text-color); }
.alerts-page h1 { margin:0 0 8px; font-size:30px; }
.alerts-page h2 { margin:0 0 16px; font-size:20px; }
.alerts-lead,.alerts-note { color:var(--text-muted-color); line-height:1.6; }
.alerts-note { font-size:12px; }
.alerts-health { padding:12px 16px; margin:18px 0; border-radius:12px; background:var(--surface-muted-bg,#f5f5fc); font-size:12px; line-height:1.6; }
.alerts-card { border:1px solid var(--border-color,#dedeea); border-radius:18px; padding:22px; margin-bottom:18px; background:var(--surface-bg,#fff); min-width:0; }
.alert-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.alert-form-grid label { display:block; font-size:13px; font-weight:700; margin-bottom:6px; }
.alerts-page .alert-native-input { width:100%; min-height:44px; border:1px solid var(--border-color,#dedeea); border-radius:8px; padding:8px 10px; box-sizing:border-box; color:var(--text-color); background:var(--input-bg,#fff); }
.alerts-columns { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.2fr); gap:18px; }
.alerts-section-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.alerts-section-heading a { color:var(--accent-color,#5b5bd6); font-size:20px; font-weight:800; }
.alert-rule,.alert-event { padding:16px 0; border-top:1px solid var(--border-color,#dedeea); overflow-wrap:anywhere; }
.alert-rule p,.alert-event p { margin:8px 0; line-height:1.5; font-size:14px; }
.alert-rule small,.alert-event small { display:block; color:var(--text-muted-color); line-height:1.6; font-size:11px; }
.alert-primary,.alert-secondary { cursor:pointer; border-radius:9px; padding:10px 16px; min-height:44px; font:inherit; font-size:13px; font-weight:700; }
.alert-primary { background:var(--accent-color,#5b5bd6); color:white; border:0; }
.alert-secondary { background:var(--surface-muted-bg,#f5f5fc); color:var(--text-color); border:1px solid var(--border-color,#dedeea); }
.alert-actions { display:flex; gap:8px; margin-top:10px; }
.alert-badge { background:var(--accent-tint-bg,#eeeefe); color:var(--accent-color,#5b5bd6); padding:4px 8px; border-radius:7px; font-size:11px; }
.alerts-feedback { margin-top:12px; line-height:1.5; font-size:13px; }
.alerts-empty { color:var(--text-muted-color); padding:14px 0; line-height:1.6; }
.alert-event details { margin:12px 0; font-size:12px; }
.alert-event summary { cursor:pointer; min-height:36px; }
@media(max-width:700px) { .alerts-columns,.alert-form-grid { grid-template-columns:1fr; } .alerts-card { padding:16px; } .alerts-page { padding-top:16px; } }

/* Keep custom field styling off the internal search input of Dash dropdowns. */
.alerts-page .Select-input > input { border:0 !important; border-radius:0 !important; box-shadow:none !important; min-height:0 !important; background:transparent !important; padding:0 !important; }
.alerts-page .Select-control { min-height:44px; border-radius:10px; }
.alerts-page .Select-value-label { line-height:42px; }
.alerts-page .Select-input { height:42px; }
.alert-field-wide { grid-column:1 / -1; min-width:0; }
.alert-rule-summary { border-left:3px solid var(--accent-color,#5b5bd6); background:var(--surface-muted-bg,#f5f5fc); border-radius:0 9px 9px 0; padding:12px 14px; margin:18px 0 12px; font-size:14px; line-height:1.5; }
.alert-customize,.alert-method,.alerts-diagnostics { font-size:12px; color:var(--text-muted-color); }
.alert-customize summary,.alert-method summary,.alerts-diagnostics summary { min-height:40px; display:list-item; align-content:center; cursor:pointer; }
.alert-customize label { display:block; margin:8px 0; }
.alert-customize input { margin-bottom:12px; }
.alert-method { margin-bottom:12px; }
.alerts-diagnostics { margin-bottom:10px; }
.alerts-diagnostics .alerts-health { margin:0 0 12px; }
#alert-market-preview { margin:14px 0; }
#alert-market-preview h3 { font-size:16px; margin:0 0 6px; }
#alert-market-preview table { width:100%; font-size:13px; border-collapse:collapse; }
#alert-market-preview th,#alert-market-preview td { padding:10px 6px; text-align:left; border-bottom:1px solid var(--border-color,#dedeea); overflow-wrap:anywhere; }
#alert-market-preview a { color:var(--accent-color,#5b5bd6); font-weight:700; }
@media(max-width:700px) {
    .alerts-lead { font-size:14px; margin:0 0 18px; }
    .alert-form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px 12px; }
    .alert-form-grid label { font-size:12px; }
    .alerts-page .alert-native-input,.alerts-page .Select-input input { font-size:16px; }
    .alerts-card .alert-primary { width:100%; }
    .alerts-card h2 { font-size:19px; margin-bottom:18px; }
    .alert-rule-summary { font-size:13px; }
}

.alert-preview-list { max-height:320px; overflow:auto; }
.alert-preview-list small { display:block; color:var(--text-muted-color); font-size:11px; line-height:1.5; }

.alert-form-grid fieldset { border:0; padding:0; margin:0; }
.alert-form-grid legend { font-size:13px; font-weight:700; margin-bottom:6px; padding:0; }
.alert-rule > summary { cursor:pointer; min-height:44px; display:list-item; font-size:15px; }
.alert-rule > summary .alert-badge { margin-left:12px; }
.alert-match-list { list-style:none; padding:0; margin:12px 0; }
.alert-match-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; padding:10px 0; border-bottom:1px solid var(--border-color,#dedeea); }
.alert-match-row a { font-weight:700; color:var(--accent-color,#5b5bd6); }
.alert-match-row > span { grid-column:1; font-size:12px; color:var(--text-muted-color); }
.alert-match-row > strong { grid-column:2; grid-row:1 / 3; align-self:center; font-size:13px; }
.alert-match-row > small { grid-column:1 / -1; }

/* Reserve the same label height for both fields so controls share a top edge. */
#alert-direction-field,
#alert-threshold-field {
  min-width:0;
  display:flex;
  flex-direction:column;
}
#alert-direction-field > label,
#alert-threshold-field > label {
  display:flex;
  align-items:flex-start;
  min-height:2.8em;
  margin-bottom:8px;
  line-height:1.4;
}
#alert-direction-field > .dash-dropdown,
#alert-direction-field > .Select,
#alert-threshold-field > input {
  width:100%;
  box-sizing:border-box;
  margin-top:auto;
}
#alert-direction-field .Select-control,
#alert-threshold-field .alert-native-input {
  height:44px;
  min-height:44px;
}

.alert-type-field { min-width:0; }
.alert-scope-summary { display:flex; flex-direction:column; gap:6px; min-width:0; }
.alert-scope-caption { font-size:13px; font-weight:700; }
#alert-scope-label { display:flex; align-items:center; min-height:44px; padding:0 12px;
 border-radius:10px; box-sizing:border-box; font-size:13px; font-weight:600;
 color:var(--text-muted-color); background:var(--surface-muted-bg); }
.alert-more-options > label { display:block; margin:8px 0; font-weight:700; }
.alert-more-options .alert-form-grid { margin:10px 0; }
.alerts-email > summary { font-size:15px; font-weight:700; cursor:pointer; min-height:24px; }
.alerts-email button { margin:4px 8px 0 0; }
.alerts-page .alert-form-grid > div > label { min-height:2.8em; line-height:1.4; }
.alerts-page .alert-form-grid > .alert-field-wide > label,
.alerts-page .alert-form-grid > .alert-type-field > label { min-height:0; }
@media(max-width:400px) {
 .alert-type-field,.alert-scope-summary { grid-column:1 / -1; }
 .alert-scope-summary { flex-direction:row; align-items:center; justify-content:space-between; }
 #alert-scope-label { min-height:32px; padding:0 10px; }
}
/* Align inputs even when a mobile label wraps onto an extra line. */
.alert-form-grid > div:not(.alert-scope-summary) { display:flex; flex-direction:column; min-width:0; }
.alert-form-grid > div > .dash-dropdown,
.alert-form-grid > div > .alert-native-input { margin-top:auto; }
