/* Status text colours: dark ink on light tints in light mode, light ink on dark tints in dark mode.
   Every pair stays at or above 4.5:1; Element Plus base hues are kept for fills, dots and bars. */
:root {
  --app-ok-text: #166534;
  --app-warn-text: #92400e;
  --app-bad-text: #b91c1c;
  --app-info-text: #475569;
  --app-pri-text: #1d4ed8;
  /* Fills that carry white text (>= 4.5:1), the same in both themes; hover/active go darker, never lighter. */
  --app-pri-solid: #2563eb;
  --app-pri-solid-hover: #1d4ed8;
  --app-pri-solid-active: #1e40af;
  --app-ok-solid: #15803d;
  --app-ok-solid-hover: #166534;
  --app-ok-solid-active: #14532d;
  --app-bad-solid: #b91c1c;
  --app-bad-solid-hover: #991b1b;
  --app-bad-solid-active: #7f1d1d;
}
html.dark {
  --app-ok-text: #4ade80;
  --app-warn-text: #fbbf24;
  --app-bad-text: #f87171;
  --app-info-text: #cbd5e1;
  --app-pri-text: #93b4f8;
}

.el-tag { --el-tag-text-color: var(--app-pri-text); font-weight: 600; }
.el-tag.el-tag--primary { --el-tag-text-color: var(--app-pri-text); }
.el-tag.el-tag--success { --el-tag-text-color: var(--app-ok-text); }
.el-tag.el-tag--warning { --el-tag-text-color: var(--app-warn-text); }
.el-tag.el-tag--danger, .el-tag.el-tag--error { --el-tag-text-color: var(--app-bad-text); }
.el-tag.el-tag--info { --el-tag-text-color: var(--app-info-text); }

/* effect="dark" puts white text on mid-tone fills (2.2-2.9:1); render it as the light tag instead. */
.el-tag--dark { --el-tag-bg-color: var(--el-color-primary-light-9); --el-tag-border-color: var(--el-color-primary-light-8); }
.el-tag--dark.el-tag--success { --el-tag-bg-color: var(--el-color-success-light-9); --el-tag-border-color: var(--el-color-success-light-8); }
.el-tag--dark.el-tag--warning { --el-tag-bg-color: var(--el-color-warning-light-9); --el-tag-border-color: var(--el-color-warning-light-8); }
.el-tag--dark.el-tag--danger, .el-tag--dark.el-tag--error { --el-tag-bg-color: var(--el-color-danger-light-9); --el-tag-border-color: var(--el-color-danger-light-8); }
.el-tag--dark.el-tag--info { --el-tag-bg-color: var(--el-color-info-light-9); --el-tag-border-color: var(--el-color-info-light-8); }
.el-tag--dark.el-tag--primary { --el-tag-text-color: var(--app-pri-text); }
.el-tag--dark.el-tag--success { --el-tag-text-color: var(--app-ok-text); }
.el-tag--dark.el-tag--warning { --el-tag-text-color: var(--app-warn-text); }
.el-tag--dark.el-tag--danger, .el-tag--dark.el-tag--error { --el-tag-text-color: var(--app-bad-text); }
.el-tag--dark.el-tag--info { --el-tag-text-color: var(--app-info-text); }

/* Buttons. Same specificity as Element Plus, loaded later: solid rules lose to its is-plain/is-text/is-link rules. */
.el-button--primary {
  --el-button-bg-color: var(--app-pri-solid); --el-button-border-color: var(--app-pri-solid);
  --el-button-hover-bg-color: var(--app-pri-solid-hover); --el-button-hover-border-color: var(--app-pri-solid-hover);
  --el-button-active-bg-color: var(--app-pri-solid-active); --el-button-active-border-color: var(--app-pri-solid-active);
}
.el-button--success {
  --el-button-bg-color: var(--app-ok-solid); --el-button-border-color: var(--app-ok-solid);
  --el-button-hover-bg-color: var(--app-ok-solid-hover); --el-button-hover-border-color: var(--app-ok-solid-hover);
  --el-button-active-bg-color: var(--app-ok-solid-active); --el-button-active-border-color: var(--app-ok-solid-active);
}
.el-button--danger {
  --el-button-bg-color: var(--app-bad-solid); --el-button-border-color: var(--app-bad-solid);
  --el-button-hover-bg-color: var(--app-bad-solid-hover); --el-button-hover-border-color: var(--app-bad-solid-hover);
  --el-button-active-bg-color: var(--app-bad-solid-active); --el-button-active-border-color: var(--app-bad-solid-active);
}
.el-button--primary.is-plain { --el-button-text-color: var(--app-pri-text); --el-button-hover-bg-color: var(--app-pri-solid); --el-button-hover-border-color: var(--app-pri-solid); }
.el-button--success.is-plain { --el-button-text-color: var(--app-ok-text); --el-button-hover-bg-color: var(--app-ok-solid); --el-button-hover-border-color: var(--app-ok-solid); }
.el-button--danger.is-plain { --el-button-text-color: var(--app-bad-text); --el-button-hover-bg-color: var(--app-bad-solid); --el-button-hover-border-color: var(--app-bad-solid); }
.el-button--primary.is-text, .el-button--primary.is-link { --el-button-text-color: var(--app-pri-text); --el-button-hover-text-color: var(--app-pri-text); --el-button-hover-link-text-color: var(--app-pri-solid-hover); }
.el-button--success.is-text, .el-button--success.is-link { --el-button-text-color: var(--app-ok-text); --el-button-hover-text-color: var(--app-ok-text); --el-button-hover-link-text-color: var(--app-ok-text); }
.el-button--danger.is-text, .el-button--danger.is-link { --el-button-text-color: var(--app-bad-text); --el-button-hover-text-color: var(--app-bad-text); --el-button-hover-link-text-color: var(--app-bad-text); }
.el-radio-button { --el-radio-button-checked-bg-color: var(--app-pri-solid); --el-radio-button-checked-border-color: var(--app-pri-solid); }

.el-form-item__error { color: var(--app-bad-text); font-weight: 500; }

.el-alert.is-light { border: 1px solid transparent; }
.el-alert--warning.is-light, .el-alert--warning.is-light .el-alert__description { color: var(--app-warn-text); }
.el-alert--warning.is-light { border-color: var(--el-color-warning-light-8); }
.el-alert--error.is-light, .el-alert--error.is-light .el-alert__description { color: var(--app-bad-text); }
.el-alert--error.is-light { border-color: var(--el-color-danger-light-8); }
.el-alert--success.is-light, .el-alert--success.is-light .el-alert__description { color: var(--app-ok-text); }
.el-alert--success.is-light { border-color: var(--el-color-success-light-8); }
.el-alert--info.is-light, .el-alert--info.is-light .el-alert__description { color: var(--app-info-text); }
.el-alert--info.is-light { border-color: var(--el-color-info-light-8); }
