:root {
  --rm-state-info: #176b87;
  --rm-state-info-soft: #eff8fb;
  --rm-state-success: #157347;
  --rm-state-success-soft: #effaf4;
  --rm-state-warning: #9a5b08;
  --rm-state-warning-soft: #fff8e8;
  --rm-state-error: #b42318;
  --rm-state-error-soft: #fff3f1;
  --rm-state-border: #d8e5e9;
  --rm-state-text: #17384d;
  --rm-state-muted: #5f7481;
  --rm-state-focus: #0f766e;
}

.rm-system-banner,
.rm-system-progress,
.rm-system-empty,
.rm-system-unavailable,
.rm-error-summary {
  box-sizing: border-box;
  color: var(--rm-state-text);
  font-family: inherit;
}

.rm-system-banner {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  width: 100%;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid #c9e0e7;
  border: 1px solid color-mix(in srgb, var(--rm-state-info) 25%, white);
  border-left: 4px solid var(--rm-state-info);
  border-radius: 12px;
  background: var(--rm-state-info-soft);
}

.rm-system-banner[data-tone="success"] {
  border-color: color-mix(in srgb, var(--rm-state-success) 25%, white);
  border-left-color: var(--rm-state-success);
  background: var(--rm-state-success-soft);
}

.rm-system-banner[data-tone="warning"] {
  border-color: color-mix(in srgb, var(--rm-state-warning) 28%, white);
  border-left-color: var(--rm-state-warning);
  background: var(--rm-state-warning-soft);
}

.rm-system-banner[data-tone="error"] {
  border-color: color-mix(in srgb, var(--rm-state-error) 25%, white);
  border-left-color: var(--rm-state-error);
  background: var(--rm-state-error-soft);
}

.rm-system-banner-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--rm-state-info);
}

.rm-system-banner[data-tone="success"] .rm-system-banner-icon { color: var(--rm-state-success); }
.rm-system-banner[data-tone="warning"] .rm-system-banner-icon { color: var(--rm-state-warning); }
.rm-system-banner[data-tone="error"] .rm-system-banner-icon { color: var(--rm-state-error); }
.rm-system-banner-icon svg { width: 20px; height: 20px; }

.rm-system-banner-copy {
  min-width: 0;
}

.rm-system-banner-copy strong,
.rm-system-banner-copy span {
  display: block;
}

.rm-system-banner-copy strong {
  margin: 1px 0 3px;
  font-size: 14px;
  line-height: 1.35;
}

.rm-system-banner-copy span {
  color: var(--rm-state-muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.rm-system-action,
.rm-error-summary button {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(15, 118, 110, .28);
  border-radius: 10px;
  background: #fff;
  color: #0d615b;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.rm-system-action:hover,
.rm-error-summary button:hover {
  border-color: rgba(15, 118, 110, .52);
  background: #f7fbfa;
}

.rm-system-action:focus-visible,
.rm-error-summary button:focus-visible,
.rm-system-progress-cancel:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .22);
  outline-offset: 2px;
}

.rm-system-progress {
  display: grid;
  gap: 11px;
  width: 100%;
  padding: 15px;
  border: 1px solid var(--rm-state-border);
  border-radius: 14px;
  background: #f8fbfc;
}

.rm-system-progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.rm-system-progress-copy {
  min-width: 0;
}

.rm-system-progress-copy strong,
.rm-system-progress-copy span {
  display: block;
}

.rm-system-progress-copy strong {
  color: var(--rm-state-text);
  font-size: 14px;
  line-height: 1.35;
}

.rm-system-progress-copy span {
  margin-top: 4px;
  color: var(--rm-state-muted);
  font-size: 14px;
  line-height: 1.5;
}

.rm-system-progress-value {
  flex: 0 0 auto;
  color: #0d615b;
  font-size: 13px;
  font-weight: 900;
}

.rm-system-progress-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dcebea;
}

.rm-system-progress-bar {
  width: var(--rm-state-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #2b86a2);
  transition: width .24s ease;
}

.rm-system-progress-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rm-system-progress-foot small {
  color: var(--rm-state-muted);
  font-size: 12px;
  line-height: 1.45;
}

.rm-system-progress-cancel {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #cfdde2;
  border-radius: 10px;
  background: #fff;
  color: #405a6a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.rm-system-progress-cancel:hover { border-color: #90a8b3; }
.rm-system-progress-cancel:disabled { cursor: wait; opacity: .62; }

.rm-error-summary {
  margin: 0 0 16px;
  padding: 13px 14px;
  border: 1px solid rgba(180, 35, 24, .24);
  border-left: 4px solid var(--rm-state-error);
  border-radius: 12px;
  background: var(--rm-state-error-soft);
}

.rm-error-summary:focus { outline: none; }
.rm-error-summary:focus-visible {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .16);
}

.rm-error-summary strong {
  display: block;
  color: #8f1d15;
  font-size: 14px;
  line-height: 1.4;
}

.rm-error-summary p {
  margin: 4px 0 8px;
  color: #70413d;
  font-size: 14px;
  line-height: 1.45;
}

.rm-error-summary ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rm-error-summary button {
  width: auto;
  min-height: 44px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: #8f1d15;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rm-field-invalid,
[aria-invalid="true"].rm-field-invalid {
  border-color: var(--rm-state-error) !important;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .11) !important;
}

.rm-field-error {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin: 6px 0 0;
  color: var(--rm-state-error);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.rm-field-error::before {
  content: "!";
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--rm-state-error);
  color: #fff;
  font-size: 11px;
  line-height: 1;
}

.rm-system-empty,
.rm-system-unavailable {
  display: grid;
  justify-items: center;
  gap: 7px;
  min-height: 150px;
  padding: 24px 18px;
  border: 1px dashed #cbdce2;
  border-radius: 14px;
  background: #fafcfd;
  text-align: center;
}

.rm-system-unavailable {
  border-style: solid;
  border-color: rgba(180, 35, 24, .2);
  background: var(--rm-state-error-soft);
}

.rm-system-state-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #eaf3f5;
  color: #446574;
}

.rm-system-unavailable .rm-system-state-icon {
  background: #fde3df;
  color: var(--rm-state-error);
}

.rm-system-state-icon svg { width: 22px; height: 22px; }
.rm-system-empty strong,
.rm-system-unavailable strong { font-size: 15px; line-height: 1.4; }
.rm-system-empty p,
.rm-system-unavailable p {
  max-width: 520px;
  margin: 0 0 5px;
  color: var(--rm-state-muted);
  font-size: 14px;
  line-height: 1.55;
}

.rm-system-connection {
  position: fixed;
  z-index: 100500;
  top: 12px;
  left: 50%;
  width: min(620px, calc(100vw - 24px));
  transform: translateX(-50%);
  filter: drop-shadow(0 12px 30px rgba(13, 39, 58, .16));
}

.rm-system-connection .rm-system-banner { margin: 0; }

.rm-system-inline-empty-action {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-top: 8px;
  color: #0d615b;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 640px) {
  .rm-system-banner { grid-template-columns: 22px minmax(0, 1fr); }
  .rm-system-banner > .rm-system-action { grid-column: 1 / -1; width: 100%; }
  .rm-system-progress-head,
  .rm-system-progress-foot { align-items: stretch; flex-direction: column; }
  .rm-system-progress-cancel { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .rm-system-progress-bar { transition: none; }
}

@media (forced-colors: active) {
  .rm-system-banner,
  .rm-system-progress,
  .rm-system-empty,
  .rm-system-unavailable,
  .rm-error-summary { border: 1px solid CanvasText; }
  .rm-system-progress-bar,
  .rm-field-error::before { background: Highlight; color: HighlightText; }
}
