.rh-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--rh-space-2);
  font-family: var(--rh-font-body); font-size: var(--rh-text-sm); font-weight: var(--rh-weight-medium);
  line-height: 1; white-space: nowrap; cursor: pointer; user-select: none;
  padding: 0 var(--rh-space-4); height: 38px;
  --rh-btn-fg: var(--rh-white);
  color: var(--rh-btn-fg); background: var(--rh-gray-900);
  border: var(--rh-border-width) solid transparent; border-radius: var(--rh-radius-md);
  transition: background var(--rh-dur) var(--rh-ease), border-color var(--rh-dur) var(--rh-ease), color var(--rh-dur) var(--rh-ease), box-shadow var(--rh-dur) var(--rh-ease);
}
.rh-btn:hover { background: var(--rh-gray-800); }
.rh-btn:active { transform: translateY(0.5px); }
.rh-btn:focus-visible { outline: none; box-shadow: var(--rh-shadow-focus); }
.rh-btn[disabled], .rh-btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.rh-btn svg { width: 16px; height: 16px; }

[data-saving-off] { opacity: 0.45; cursor: not-allowed; }
.rh-btn[data-saving-off] { pointer-events: auto; }

a.rh-btn.rh-btn,
a.rh-btn.rh-btn:is(:link, :visited, :hover, :focus, :focus-visible, :active) {
  color: var(--rh-btn-fg);
  text-decoration: none;
}

.rh-btn--primary { --rh-btn-fg: var(--rh-white); background: var(--rh-red-600); color: var(--rh-btn-fg); border-color: transparent; }
.rh-btn--primary:hover { background: var(--rh-red-700); }
.rh-btn--primary:active { background: var(--rh-red-800); }

.rh-btn--secondary { --rh-btn-fg: var(--rh-text); background: var(--rh-surface); color: var(--rh-btn-fg); border-color: var(--rh-border-strong); }
.rh-btn--secondary:hover { background: var(--rh-surface-subtle); border-color: var(--rh-gray-400); }

.rh-btn--ghost { --rh-btn-fg: var(--rh-text); background: transparent; color: var(--rh-btn-fg); border-color: transparent; }
.rh-btn--ghost:hover { background: var(--rh-surface-subtle); }

.rh-btn--danger { --rh-btn-fg: var(--rh-red-600); background: transparent; color: var(--rh-btn-fg); border-color: var(--rh-red-600); }
.rh-btn--danger:hover { background: var(--rh-red-50); }

.rh-btn--sm { height: 30px; font-size: var(--rh-text-xs); padding: 0 var(--rh-space-3); }
.rh-btn--lg { height: 46px; font-size: var(--rh-text-base); padding: 0 var(--rh-space-6); }
.rh-btn--block { display: flex; width: 100%; }

.rh-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; cursor: pointer;
  color: var(--rh-text-muted); background: transparent;
  border: var(--rh-border-width) solid transparent; border-radius: var(--rh-radius-md);
  transition: background var(--rh-dur) var(--rh-ease), color var(--rh-dur) var(--rh-ease);
}
.rh-icon-btn:hover { background: var(--rh-surface-subtle); color: var(--rh-text); }
.rh-icon-btn:focus-visible { outline: none; box-shadow: var(--rh-shadow-focus); }
.rh-icon-btn svg { width: 18px; height: 18px; }
.rh-icon-btn--sm { width: 30px; height: 30px; } .rh-icon-btn--sm svg { width: 15px; height: 15px; }

.rh-field { display: flex; flex-direction: column; gap: var(--rh-space-2); }
.rh-label { font-size: var(--rh-text-sm); font-weight: var(--rh-weight-medium); color: var(--rh-text); }
.rh-label .rh-req { color: var(--rh-red-600); margin-left: 2px; }
.rh-input, .rh-select {
  font-family: var(--rh-font-body); font-size: var(--rh-text-sm); color: var(--rh-text);
  height: 38px; padding: 0 var(--rh-space-3); width: 100%;
  background: var(--rh-surface); border: var(--rh-border-width) solid var(--rh-border-strong);
  border-radius: var(--rh-radius-md);
  transition: border-color var(--rh-dur) var(--rh-ease), box-shadow var(--rh-dur) var(--rh-ease);
}
.rh-input::placeholder { color: var(--rh-text-subtle); }
.rh-input:hover, .rh-select:hover { border-color: var(--rh-gray-400); }
.rh-input:focus, .rh-select:focus { outline: none; border-color: var(--rh-red-600); box-shadow: var(--rh-shadow-focus); }
.rh-input[disabled], .rh-select[disabled] { background: var(--rh-surface-subtle); color: var(--rh-text-subtle); cursor: not-allowed; }
textarea.rh-input { height: auto; padding: var(--rh-space-2) var(--rh-space-3); resize: vertical; line-height: 1.5; }
.rh-hint { font-size: var(--rh-text-xs); color: var(--rh-text-muted); }
.rh-field--error .rh-input, .rh-field--error .rh-select { border-color: var(--rh-red-600); }
.rh-field--error .rh-hint { color: var(--rh-red-600); }
.rh-select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}

.rh-check { display: inline-flex; align-items: center; gap: var(--rh-space-2); cursor: pointer; font-size: var(--rh-text-sm); color: var(--rh-text); }
.rh-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.rh-check__box {
  width: 18px; height: 18px; border: 1.5px solid var(--rh-border-strong); border-radius: var(--rh-radius-sm);
  background: var(--rh-surface); display: inline-flex; align-items: center; justify-content: center; flex: none;
  transition: background var(--rh-dur) var(--rh-ease), border-color var(--rh-dur) var(--rh-ease);
}
.rh-check__box svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
.rh-check input:checked + .rh-check__box { background: var(--rh-red-600); border-color: var(--rh-red-600); }
.rh-check input:checked + .rh-check__box svg { opacity: 1; }
.rh-check input:focus-visible + .rh-check__box { box-shadow: var(--rh-shadow-focus); }

.rh-switch { display: inline-flex; align-items: center; gap: var(--rh-space-2); cursor: pointer; font-size: var(--rh-text-sm); color: var(--rh-text); }
.rh-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.rh-switch__track {
  width: 38px; height: 22px; border-radius: var(--rh-radius-full); background: var(--rh-gray-300);
  position: relative; transition: background var(--rh-dur) var(--rh-ease); flex: none;
}
.rh-switch__track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: var(--rh-shadow-sm); transition: transform var(--rh-dur) var(--rh-ease-out);
}
.rh-switch input:checked + .rh-switch__track { background: var(--rh-red-600); }
.rh-switch input:checked + .rh-switch__track::after { transform: translateX(16px); }
.rh-switch input:focus-visible + .rh-switch__track { box-shadow: var(--rh-shadow-focus); }

.rh-badge {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--rh-font-body);
  font-size: var(--rh-text-xs); font-weight: var(--rh-weight-medium); line-height: 1;
  padding: 4px 8px; border-radius: var(--rh-radius-sm); border: 1px solid transparent;
  background: var(--rh-surface-subtle); color: var(--rh-text);
}
.rh-badge--accent  { background: var(--rh-red-50); color: var(--rh-red-700); }
.rh-badge--success { background: var(--rh-success-100); color: var(--rh-success-600); }
.rh-badge--warning { background: var(--rh-warning-100); color: var(--rh-warning-600); }
.rh-badge--info    { background: var(--rh-info-100); color: var(--rh-info-600); }
.rh-badge--outline { background: transparent; border-color: var(--rh-border-strong); color: var(--rh-text-muted); }
.rh-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.rh-tag {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--rh-font-mono);
  font-size: var(--rh-text-xs); color: var(--rh-text); background: var(--rh-surface);
  border: 1px solid var(--rh-border-strong); border-radius: var(--rh-radius-sm); padding: 4px 6px 4px 9px;
}
.rh-tag__remove { display: inline-flex; cursor: pointer; color: var(--rh-text-subtle); border-radius: 2px; }
.rh-tag__remove:hover { color: var(--rh-red-600); }
.rh-tag__remove svg { width: 13px; height: 13px; }

.rh-card {
  background: var(--rh-surface); border: var(--rh-border-width) solid var(--rh-border);
  border-radius: var(--rh-radius-card); overflow: hidden;
  transition: box-shadow var(--rh-dur) var(--rh-ease), border-color var(--rh-dur) var(--rh-ease);
}
.rh-card--interactive { cursor: pointer; }
.rh-card--interactive:hover { box-shadow: var(--rh-shadow-md); border-color: var(--rh-border-strong); }
.rh-card--flat { box-shadow: none; }
.rh-card--raised { box-shadow: var(--rh-shadow-md); border-color: transparent; }
.rh-card__body { padding: var(--rh-space-6); }
.rh-card__header { padding: var(--rh-space-5) var(--rh-space-6); border-bottom: 1px solid var(--rh-border); }
.rh-card__footer { padding: var(--rh-space-4) var(--rh-space-6); border-top: 1px solid var(--rh-border); background: var(--rh-surface-subtle); }
.rh-card__title { font: var(--rh-text-h4); margin: 0; }

.rh-callout {
  display: flex; gap: var(--rh-space-3); padding: var(--rh-space-4);
  border: 1px solid var(--rh-border); border-left-width: 3px; border-radius: var(--rh-radius-md);
  background: var(--rh-surface-subtle); color: var(--rh-text);
}
.rh-callout__icon { flex: none; color: var(--rh-text-muted); margin-top: 1px; }
.rh-callout__icon svg { width: 18px; height: 18px; }
.rh-callout__title { font-weight: var(--rh-weight-medium); font-size: var(--rh-text-sm); margin: 0 0 2px; }
.rh-callout__body { font-size: var(--rh-text-sm); color: var(--rh-text-muted); line-height: 1.5; }
.rh-callout--accent  { border-left-color: var(--rh-red-600); } .rh-callout--accent  .rh-callout__icon { color: var(--rh-red-600); }
.rh-callout--success { border-left-color: var(--rh-success-600); } .rh-callout--success .rh-callout__icon { color: var(--rh-success-600); }
.rh-callout--warning { border-left-color: var(--rh-warning-600); } .rh-callout--warning .rh-callout__icon { color: var(--rh-warning-600); }
.rh-callout--info    { border-left-color: var(--rh-info-600); } .rh-callout--info .rh-callout__icon { color: var(--rh-info-600); }

.rh-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rh-border); }
.rh-tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  font-family: var(--rh-font-body); font-size: var(--rh-text-sm); font-weight: var(--rh-weight-medium);
  color: var(--rh-text-muted); padding: var(--rh-space-3) var(--rh-space-4);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--rh-dur) var(--rh-ease), border-color var(--rh-dur) var(--rh-ease);
}
.rh-tab:hover { color: var(--rh-text); }
.rh-tab[aria-selected="true"] { color: var(--rh-text-strong); border-bottom-color: var(--rh-red-600); }
.rh-tab:focus-visible { outline: none; box-shadow: var(--rh-shadow-focus); border-radius: var(--rh-radius-sm); }
