/* RecodeX controls. Shared by Tools, Account, and isolated local workspaces. */
body {
  --rx-surface: var(--surface, #fff);
  --rx-text: var(--text, var(--ink, #202b46));
  --rx-soft: var(--soft, #eef1ff);
  --rx-border: var(--border, #e7eaf2);
  --rx-accent: var(--brand, var(--accent, #5269de));
  --rx-accent-text: #4358c7;
  --rx-muted: #606b82;
  --rx-check-ink: #fff;
  --rx-action-ink: #fff;
  --rx-action-hover: #435bcc;
  --rx-danger: #b63852;
  --rx-danger-soft: #fff0f3;
  --rx-menu-shadow: 0 18px 48px #202b461a, 0 3px 10px #202b460a;
  --rx-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10 3.2 3.2L15 6.4' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --rx-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10h10' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
body.dark {
  --rx-accent-text: #afbdff;
  --rx-muted: #acb7cc;
  --rx-check-ink: #17243b;
  --rx-action-ink: #172044;
  --rx-action-hover: #b6c2ff;
  --rx-danger: #ffb2c2;
  --rx-danger-soft: #402936;
  --rx-menu-shadow: 0 20px 50px #0006, 0 3px 10px #0003;
  --rx-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10 3.2 3.2L15 6.4' fill='none' stroke='%2317243b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --rx-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10h10' stroke='%2317243b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Real inputs keep keyboard interaction, labels, validation, and form values. */
body
  :is(input[type="checkbox"], input[type="radio"]):not([data-rx-native]):not(
    .pdf-preset input
  ) {
  appearance: none;
  -webkit-appearance: none;
  display: inline-block;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px;
  min-height: 20px;
  flex: 0 0 20px;
  vertical-align: middle;
  margin: 2px 0;
  padding: 0 !important;
  border: 1.5px solid color-mix(in srgb, var(--rx-muted) 62%, var(--rx-surface));
  border-radius: 6px;
  background: var(--rx-surface) center / 18px 18px no-repeat;
  box-shadow: 0 1px 2px #202b4608;
  cursor: pointer;
  opacity: 1;
  transition:
    background-color 0.18s,
    border-color 0.18s,
    box-shadow 0.18s;
}
body
  :is(input[type="checkbox"], input[type="radio"]):not([data-rx-native]):not(
    .pdf-preset input
  ):hover:not(:disabled) {
  border-color: var(--rx-accent);
  box-shadow: 0 0 0 3px var(--rx-soft);
}
body
  :is(input[type="checkbox"], input[type="radio"]):not([data-rx-native]):not(
    .pdf-preset input
  ):checked,
body input[type="checkbox"]:not([data-rx-native]):indeterminate {
  border-color: var(--rx-accent);
  background-color: var(--rx-accent);
  background-image: var(--rx-check);
}
body input[type="checkbox"]:not([data-rx-native]):indeterminate {
  background-image: var(--rx-dash);
}
body input[type="radio"]:not([data-rx-native]):not(.pdf-preset input) {
  border-radius: 50%;
}
body input[type="radio"]:not([data-rx-native]):not(.pdf-preset input):checked {
  background-image: radial-gradient(
    circle,
    var(--rx-check-ink) 0 3px,
    transparent 3.5px
  );
}
body
  :is(input[type="checkbox"], input[type="radio"]):not([data-rx-native]):not(
    .pdf-preset input
  ):focus-visible {
  outline: 2px solid var(--rx-accent);
  outline-offset: 3px;
}
body
  :is(input[type="checkbox"], input[type="radio"]):not([data-rx-native]):not(
    .pdf-preset input
  ):disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}
.rx-choice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 44px;
  padding: 9px 0;
  cursor: pointer;
  color: var(--rx-text);
}
.rx-choice > span {
  min-width: 0;
}
.rx-choice strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
.rx-choice small {
  display: block;
  color: var(--rx-muted);
  font-size: 11px;
  margin-top: 3px;
}

/* The native select is the source of truth and remains a real form control. */
body
  select:not([multiple]):not([size]):not(.rx-native-select):not(
    [data-rx-native]
  ) {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5.5 7.5 4.5 4.5 4.5-4.5' stroke='%23717d95' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 18px;
  background-position: right 12px center;
  background-repeat: no-repeat;
  padding-right: 39px;
}
.rx-select {
  display: block;
  position: relative;
  width: 100%;
  min-width: 0;
  font: inherit;
}
body select.rx-native-select {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  pointer-events: none !important;
}
body .rx-select .rx-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--rx-border);
  border-radius: 11px;
  background: var(--rx-surface);
  color: var(--rx-text);
  box-shadow: 0 1px 2px #202b4605;
  text-align: left;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transform: none;
  transition:
    border-color 0.18s,
    box-shadow 0.18s,
    background-color 0.18s;
}
body .rx-select .rx-select-trigger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--rx-accent) 50%, var(--rx-border));
  background: var(--rx-surface);
  color: var(--rx-text);
  transform: none;
}
body .rx-select .rx-select-trigger:focus-visible,
body .rx-select.is-open .rx-select-trigger {
  outline: none;
  border-color: var(--rx-accent);
  box-shadow: 0 0 0 3px var(--rx-soft);
}
body .rx-select.is-invalid .rx-select-trigger {
  border-color: var(--rx-danger);
}
body .rx-select .rx-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}
.rx-select-value {
  display: block;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rx-select-value.is-placeholder {
  color: var(--rx-muted);
}
.rx-chevron {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: var(--rx-muted);
  transition: transform 0.18s;
  pointer-events: none;
}
.rx-select.is-open .rx-chevron,
[aria-expanded="true"] > .rx-chevron {
  transform: rotate(180deg);
}
.rx-field-error {
  display: block;
  margin-top: 7px;
  color: var(--rx-danger);
  font-size: 11px;
  line-height: 1.5;
}
.size-input > .rx-select {
  flex: 0 0 90px;
  width: 90px;
}
.rx-select[data-size="sm"] .rx-select-trigger {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 11px;
}
.rx-select[data-size="lg"] .rx-select-trigger {
  min-height: 50px;
  padding: 13px 16px;
  font-size: 14px;
}

/* A fixed portal escapes card overflow, with a viewport bridge for PDF iframes. */
body .rx-select-menu,
body .rx-dropdown .rx-dropdown-panel {
  position: fixed;
  z-index: 10020;
  inset: auto;
  padding: 6px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--rx-border);
  border-radius: 15px;
  background: var(--rx-surface);
  color: var(--rx-text);
  box-shadow: var(--rx-menu-shadow);
  font-size: 12px;
  line-height: 1.5;
  animation: rx-menu-in 0.16s ease-out;
}
body .rx-select-menu[hidden],
body .rx-dropdown-panel[hidden],
body input[type="checkbox"][hidden],
body input[type="radio"][hidden],
.rx-field-error[hidden],
.rx-select[hidden] {
  display: none !important;
}
.rx-select-search-wrap {
  padding: 6px 6px 10px;
  border-bottom: 1px solid var(--rx-border);
  margin-bottom: 5px;
}
body .rx-select-menu .rx-select-search {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  margin: 0;
  border: 1px solid var(--rx-border);
  border-radius: 9px;
  background: var(--rx-surface);
  color: var(--rx-text);
  font: inherit;
  outline-offset: 2px;
}
body .rx-select-menu .rx-select-search:focus-visible {
  outline: 2px solid var(--rx-accent);
}
.rx-select-list {
  overflow: auto;
  /* Let wheel/touch scrolling continue to the page at either list boundary. */
  overscroll-behavior: auto;
  scrollbar-width: thin;
  padding: 1px;
  outline: none;
}
.rx-select-group {
  padding: 11px 10px 6px;
  color: var(--rx-muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  font-weight: 650;
}
body .rx-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  margin: 2px 0;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--rx-text);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-weight: 450;
}
body .rx-select-option.is-active {
  background: var(--rx-soft);
}
body .rx-select-option[aria-selected="true"] {
  color: var(--rx-accent-text);
  background: var(--rx-soft);
  font-weight: 650;
}
body .rx-select-option.is-active[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--rx-accent) 45%, var(--rx-border));
}
body .rx-select-option[aria-disabled="true"] {
  opacity: 0.48;
  cursor: not-allowed;
  background: transparent;
}
.rx-option-copy {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.rx-option-description {
  display: block;
  color: var(--rx-muted);
  font-weight: 400;
  font-size: 11px;
  margin-top: 3px;
}
.rx-option-check {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  visibility: hidden;
}
[aria-selected="true"] > .rx-option-check {
  visibility: visible;
}
.rx-option-icon {
  width: 20px;
  flex: 0 0 20px;
  font-size: 16px;
  color: var(--rx-accent-text);
  text-align: center;
}
.rx-select-empty {
  margin: 0;
  padding: 22px 12px;
  text-align: center;
  color: var(--rx-muted);
}

.rx-dropdown {
  position: relative;
}
body .account-profile[data-rx-toggle] {
  padding: 5px 8px 5px 5px;
  border: 1px solid transparent;
  border-radius: 12px;
  text-align: left;
  transition:
    background 0.18s,
    border-color 0.18s;
}
body .account-profile[data-rx-toggle]:hover,
body .account-profile[data-rx-toggle][aria-expanded="true"] {
  background: var(--rx-soft);
  border-color: var(--rx-border);
}
.account-profile .account-chevron {
  color: var(--rx-muted);
  font-size: 11px;
  margin-left: 3px;
  transition: transform 0.18s;
}
.account-profile[aria-expanded="true"] .account-chevron {
  transform: rotate(180deg);
}
body .rx-dropdown .rx-dropdown-panel {
  width: 290px;
  max-width: calc(100vw - 20px);
  overflow: auto;
}
body .rx-dropdown .rx-menu-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 11px 16px;
  margin: 0 0 6px;
  border-bottom: 1px solid var(--rx-border);
}
.rx-menu-heading strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
}
.rx-menu-heading small {
  display: block;
  color: var(--rx-muted);
  font-size: 11px;
  margin-top: 3px;
}
body .rx-dropdown-panel .rx-menu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  margin: 2px 0;
  padding: 11px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--rx-text);
  text-align: left;
  text-decoration: none;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
  cursor: pointer;
}
body .rx-dropdown-panel .rx-menu-item:hover,
body .rx-dropdown-panel .rx-menu-item:focus-visible {
  background: var(--rx-soft);
  color: var(--rx-accent-text);
  outline: none;
}
body .rx-dropdown-panel .rx-menu-item:focus-visible {
  box-shadow: inset 0 0 0 2px var(--rx-accent);
}
.rx-menu-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  background: var(--rx-soft);
  color: var(--rx-accent-text);
  font-size: 18px;
}
.rx-menu-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rx-menu-copy strong {
  font-size: 12px;
  font-weight: 650;
}
.rx-menu-copy small {
  color: var(--rx-muted);
  font-size: 10px;
  font-weight: 400;
}
.rx-menu-arrow {
  margin-left: auto;
  color: var(--rx-muted);
}
.rx-menu-divider {
  border: 0;
  border-top: 1px solid var(--rx-border);
  padding-top: 6px;
  margin: 6px 0 0;
}
body .rx-dropdown-panel .rx-menu-item.is-danger {
  color: var(--rx-danger);
}
body .rx-dropdown-panel .rx-menu-item.is-danger:hover,
body .rx-dropdown-panel .rx-menu-item.is-danger:focus-visible {
  background: var(--rx-danger-soft);
  color: var(--rx-danger);
}
.rx-menu-item.is-danger .rx-menu-icon {
  background: var(--rx-danger-soft);
  color: var(--rx-danger);
}
body .rx-dropdown-panel .rx-menu-item:disabled,
body .rx-dropdown-panel .rx-menu-item[aria-disabled="true"] {
  opacity: 0.48;
  cursor: not-allowed;
  background: transparent;
}
body .card-more.rx-dropdown > summary {
  border-radius: 9px;
  min-width: 38px;
  min-height: 38px;
  color: var(--rx-muted);
  background: var(--rx-surface);
}
body .card-more.rx-dropdown[open] > summary {
  border-color: var(--rx-accent);
  background: var(--rx-soft);
}
@keyframes rx-menu-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Filled controls always keep their foreground paired with their background.
   New upload triggers can reuse rx-upload-button in any shared layout. */
.rx-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 12px 20px;
  border: 1px solid;
  border-radius: 12px;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
body :is(.rx-upload-button, .pf-select, .pdf-select, .m-btn.primary, .btn.primary, .btn-primary, .button:not(.secondary):not(.google-button)) {
  background-color: var(--brand, var(--accent, #5269de));
  border-color: var(--brand, var(--accent, #5269de));
  color: var(--rx-action-ink);
}
body :is(.rx-upload-button, .pf-select, .pdf-select, .m-btn.primary, .btn.primary, .btn-primary, .button:not(.secondary):not(.google-button)):is(:hover, :active):not(:disabled) {
  background-color: var(--rx-action-hover);
  border-color: var(--rx-action-hover);
  color: var(--rx-action-ink);
}
body :is(.rx-upload-button, .pf-select, .pdf-select, .m-btn.primary, .btn.primary, .btn-primary, .button:not(.secondary):not(.google-button)):focus-visible {
  color: var(--rx-action-ink);
  outline: 3px solid var(--rx-accent);
  outline-offset: 3px;
}
body :is(.rx-upload-button, .pf-select, .pdf-select, .m-btn.primary, .btn.primary, .btn-primary, .button:not(.secondary):not(.google-button)) > :is(span, i, svg) {
  color: inherit;
}
body input[type="file"] {
  color: var(--rx-text);
}
body input[type="file"]::file-selector-button {
  min-height: 42px;
  margin-inline-end: 12px;
  padding: 9px 15px;
  border: 1px solid var(--brand, var(--accent, #5269de));
  border-radius: 10px;
  background-color: var(--brand, var(--accent, #5269de));
  color: var(--rx-action-ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background-color .18s, border-color .18s;
}
body input[type="file"]:hover:not(:disabled)::file-selector-button,
body input[type="file"]:active:not(:disabled)::file-selector-button {
  background-color: var(--rx-action-hover);
  border-color: var(--rx-action-hover);
  color: var(--rx-action-ink);
}
body input[type="file"]:focus-visible {
  outline: 3px solid var(--rx-accent);
  outline-offset: 3px;
}
body input[type="file"]:disabled::file-selector-button {
  cursor: not-allowed;
  opacity: .5;
}

@media (pointer: coarse) {
  body .rx-select-option {
    min-height: 46px;
  }
}
@media (prefers-reduced-motion: reduce) {
  body input[type="file"]::file-selector-button {
    transition: none;
  }
  .rx-select *,
  .rx-select-menu,
  .rx-dropdown * {
    transition: none !important;
    animation: none !important;
  }
}
@media (forced-colors: active) {
  body
    :is(input[type="checkbox"], input[type="radio"]):not([data-rx-native]):not(
      .pdf-preset input
    ) {
    appearance: auto;
    background-image: none !important;
    background-color: Canvas !important;
    border-color: ButtonText !important;
    box-shadow: none !important;
  }
  body .rx-select .rx-select-trigger,
  body .rx-select-menu,
  body .rx-dropdown .rx-dropdown-panel {
    background: Canvas;
    color: CanvasText;
    border-color: ButtonText;
    box-shadow: none;
  }
  .rx-select-option.is-active {
    outline: 1px solid Highlight;
  }
}
