/* ForgeOS access controls and right-to-left support (forgeos-access.js,
 * forgeos-i18n.js). Logical properties throughout, so the same rules lay out
 * left-to-right and right-to-left. Colours come from the platform tokens, so
 * both themes follow. */

.fa-open { font-weight: 600; letter-spacing: 0.01em; }
.cw-composer .fa-open { padding-inline: 10px; flex: none; }
.fa-open-mark { font-size: 0.95em; line-height: 1; }
.fa-open[aria-expanded="true"] { border-color: var(--m19-accent, #4f46e5); }

.fa-panel {
  margin-block: 0 var(--m19-space-2, 8px);
  margin-inline: auto;
  max-inline-size: 420px;
  padding: var(--m19-space-3, 12px) var(--m19-space-4, 16px);
  border: 1px solid var(--m19-line, #e6e8f0);
  border-radius: 14px;
  background: var(--m19-surface, #fff);
  color: var(--m19-ink, #101828);
  box-shadow: 0 8px 28px rgb(16 24 40 / 0.12);
  display: grid;
  gap: var(--m19-space-2, 8px);
}
.fa-panel[hidden] { display: none; }
.fa-panel-title { margin: 0; font-weight: 600; font-size: var(--m19-text-sm, 0.875rem); }

.fa-lang { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--m19-text-sm, 0.875rem); }
.fa-select {
  min-block-size: 40px;
  padding-inline: 10px;
  border: 1px solid var(--m19-line-strong, #d3d7e4);
  border-radius: 10px;
  background: var(--m19-canvas, #f7f8fc);
  color: var(--m19-ink, #0e1017);
  font: inherit;
}
.fa-select:focus-visible, .fa-switch:focus-visible, .fa-open:focus-visible {
  outline: 3px solid var(--m19-accent, #4f46e5);
  outline-offset: 2px;
}

.fa-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  inline-size: 100%;
  min-block-size: 48px;
  padding-block: 6px;
  padding-inline: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.fa-switch-text { display: grid; gap: 2px; }
.fa-switch-label { font-size: var(--m19-text-sm, 0.875rem); font-weight: 600; }
.fa-switch-hint { font-size: var(--m19-text-xs, 0.75rem); color: var(--m19-ink-3, #667085); }
.fa-switch-knob {
  flex: none;
  inline-size: 40px; block-size: 24px;
  border-radius: 999px;
  background: var(--m19-line-strong, #d3d7e4);
  position: relative;
  transition: background 160ms ease;
}
.fa-switch-knob::after {
  content: "";
  position: absolute;
  inset-block-start: 3px; inset-inline-start: 3px;
  inline-size: 18px; block-size: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}
.fa-switch[aria-checked="true"] .fa-switch-knob { background: var(--m19-accent, #4f46e5); }
.fa-switch[aria-checked="true"] .fa-switch-knob::after { transform: translateX(16px); }
[dir="rtl"] .fa-switch[aria-checked="true"] .fa-switch-knob::after { transform: translateX(-16px); }
.fa-keys { margin: 0; font-size: var(--m19-text-xs, 0.75rem); color: var(--m19-ink-3, #667085); }

.fa-footer { margin-block-start: var(--m19-space-3, 12px); display: flex; justify-content: center; }
.fa-footer .fa-lang { gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  .fa-switch-knob, .fa-switch-knob::after { transition: none; }
}

/* ── Right to left ───────────────────────────────────────────────────────
 * The page's own stylesheets are written left-to-right and other lanes are
 * rewriting them; these are the places where the direction is wrong enough
 * to read badly in Arabic, corrected without touching those files. */
[dir="rtl"] body { text-align: start; }
[dir="rtl"] .cw-composer, [dir="rtl"] .cw-thread, [dir="rtl"] .cw-rail { direction: rtl; }
[dir="rtl"] .cw-msg--user { justify-content: flex-start; }
[dir="rtl"] .cw-checklist { padding-inline-start: 0; }
[dir="rtl"] .cw-bubble, [dir="rtl"] .cw-card { text-align: start; }
[dir="rtl"] .ico-flip-rtl, [dir="rtl"] .cw-jump svg { transform: scaleX(-1); }
