.fj-app .fj-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--fj-control-height); min-width: var(--fj-control-height); padding: 5px 12px; border: 1px solid var(--fj-border); border-radius: var(--fj-radius); background: var(--fj-surface); color: var(--fj-secondary); font-weight: 600; font-size: 13px; text-decoration: none; cursor: pointer; }
@media (hover: hover) {
.fj-app .fj-button:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--fj-subtle); }
}
.fj-app .fj-button--primary { background: var(--fj-action); border-color: var(--fj-action); color: white; }
@media (hover: hover) {
.fj-app .fj-button--primary:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--fj-action-hover); }
}
.fj-app .fj-button--danger { background: var(--fj-error); border-color: var(--fj-error); color: white; }
@media (hover: hover) {
.fj-app .fj-button--danger:hover:not(:disabled):not([aria-disabled="true"]) { background: #8e2923; }
}
.fj-app .fj-button--quiet { background: transparent; border-color: transparent; }
.fj-app :where(button, input, select, textarea):disabled, .fj-app [aria-disabled=true] { opacity: .55; cursor: not-allowed; }
.fj-app [aria-busy=true] { cursor: progress; }
.fj-app .fj-page-header, .fj-app .fj-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.fj-app .fj-page-header h1 { margin: 0; letter-spacing: -.015em; }
.fj-app .fj-page-header p { margin: 4px 0 0; font-size: 13px; }
.fj-app .fj-back { display: inline-block; margin-bottom: 12px; }
.fj-app .fj-surface { border: 1px solid var(--fj-border); border-radius: var(--fj-radius-lg); background: var(--fj-surface); padding: 20px; margin-bottom: 20px; min-width: 0; }
.fj-app .fj-field { margin-bottom: 16px; min-width: 0; }
.fj-app .fj-field :where(label, legend) { font-size: 12px; font-weight: 600; }
.fj-app .fj-field > label { display: block; margin-bottom: 6px; }
.fj-app .fj-field-requirement { font-weight: 400; color: var(--fj-secondary); }
.fj-app .fj-field fieldset, .fj-app .fj-choice-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.fj-app .fj-field :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea), .fj-app .fj-input { width: 100%; min-width: 0; min-height: var(--fj-control-height); padding: 5px 10px; border: 1px solid var(--fj-border); border-radius: var(--fj-radius); background: white; color: var(--fj-ink); }
.fj-app .fj-field textarea { min-height: 96px; resize: vertical; }
.fj-app .fj-field :where(input[type=checkbox], input[type=radio]) { accent-color: var(--fj-action); width: 16px; height: 16px; flex-shrink: 0; }
.fj-app .fj-field label:has(:is(input[type=checkbox], input[type=radio])) { display: flex; align-items: center; gap: 8px; min-height: var(--fj-control-height); }
.fj-app .fj-input-unit { display: flex; align-items: center; gap: 8px; }
.fj-app .fj-input-unit > :not(span) { min-width: 0; flex: 1; }
.fj-app .fj-help { font-size: 12px; color: var(--fj-secondary); margin-top: 6px; overflow-wrap: anywhere; }
.fj-app .fj-field-error { font-size: 12px; color: var(--fj-error); margin-top: 6px; }
.fj-app .fj-field-error ul { margin: 0; padding-left: 16px; }
.fj-app .fj-field [aria-invalid=true], .fj-app .fj-input[aria-invalid=true] { border-color: var(--fj-error); }
.fj-app .fj-readonly { padding-block: 6px; overflow-wrap: anywhere; }
.fj-app .fj-choice { display: flex; align-items: start; gap: 8px; border: 1px solid var(--fj-border); border-radius: 6px; padding: 12px; cursor: pointer; }
.fj-app .fj-choice:has(:checked) { background: var(--fj-action-soft); border-color: var(--fj-action); }
.fj-app .fj-form--dense { --fj-control-height: 36px; }
.fj-app .fj-notice { padding: 12px 16px; border: 1px solid var(--fj-border); border-radius: 6px; background: white; margin-bottom: 16px; overflow-wrap: anywhere; }
.fj-app .fj-notice--error { color: var(--fj-error); background: var(--fj-error-soft); border-color: #e6b5b0; }
.fj-app .fj-notice--warning { color: var(--fj-warning); background: var(--fj-warning-soft); }
.fj-app .fj-notice--success { color: var(--fj-success); background: var(--fj-success-soft); }
.fj-app .fj-toast-stack { position: fixed; top: 16px; right: 16px; width: min(360px, calc(100vw - 32px)); z-index: 70; display: grid; gap: 8px; pointer-events: none; }
.fj-app .fj-toast { display: flex; align-items: start; gap: 12px; margin: 0; box-shadow: 0 8px 28px #14161c24; pointer-events: auto; }
.fj-app .fj-toast-close { margin: -5px -8px -5px auto; padding: 5px 8px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
@media (max-width: 719px) { .fj-app .fj-toast-stack { top: 76px; } }
.fj-app .fj-badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--fj-subtle); }
.fj-app .fj-badge--success { color: var(--fj-success); background: var(--fj-success-soft); }
.fj-app .fj-badge--warning { color: var(--fj-warning); background: var(--fj-warning-soft); }
.fj-app .fj-badge--error { color: var(--fj-error); background: var(--fj-error-soft); }
.fj-app .fj-table-scroll { max-width: 100%; overflow-x: auto; }
.fj-app .fj-table { width: 100%; border-collapse: collapse; text-align: left; }
.fj-app .fj-table :where(th, td) { padding: 12px; border-bottom: 1px solid var(--fj-border); vertical-align: top; overflow-wrap: anywhere; }
.fj-app .fj-table th { color: var(--fj-secondary); font-size: 12px; font-weight: 600; }
.fj-app .fj-table .fj-number { text-align: right; }
.fj-app .fj-list { list-style: none; margin: 0; padding: 0; }
.fj-app .fj-list > li { padding: 16px 0; border-bottom: 1px solid var(--fj-border); overflow-wrap: anywhere; }
.fj-app .fj-empty { text-align: center; padding: 32px 16px; color: var(--fj-secondary); }
.fj-app .fj-menu { position: relative; }
.fj-app .fj-menu > summary { list-style: none; }
.fj-app .fj-menu > summary::-webkit-details-marker { display: none; }
.fj-app .fj-menu-panel { position: absolute; right: 0; z-index: 20; min-width: 180px; max-width: calc(100vw - 24px); padding: 6px; background: white; border: 1px solid var(--fj-border); border-radius: 6px; box-shadow: 0 8px 24px #0002; }
.fj-app .fj-menu-panel :where(a, button) { display: flex; width: 100%; justify-content: start; }
.fj-app .fj-dialog { padding: 0; width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--fj-border); border-radius: 10px; color: var(--fj-ink); background: var(--fj-surface); box-shadow: 0 16px 64px #0003; }
.fj-app .fj-dialog::backdrop { background: rgb(26 26 28 / 35%); }
.fj-app .fj-dialog-body { padding: 24px; }
.fj-app .fj-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--fj-border); background: white; }
.fj-app .fj-sheet { margin: 0 0 0 auto; width: min(560px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
.fj-app .fj-sheet[open] { display: flex; flex-direction: column; }
.fj-app .fj-sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px; border-bottom: 1px solid var(--fj-border); }
.fj-app .fj-sheet-header h2 { margin: 0; }
.fj-app .fj-sheet-body { padding: 20px; overflow: auto; flex: 1; min-height: 0; scroll-padding-block: 16px; }
.fj-app .fj-action-bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--fj-border); background: white; z-index: 10; }
.fj-app [data-fj-action-scope] { padding-bottom: var(--fj-action-inset, 0px); }
.fj-app [data-fj-action-scope] :where(input, select, textarea, [tabindex]) { scroll-margin-block: 20px calc(var(--fj-action-inset, 0px) + 20px); }
@media (max-width: 719px) {
  .fj-app .fj-form--dense { --fj-control-height: 44px; }
  .fj-app .fj-sheet { width: 100vw; }
  .fj-app .fj-dialog-actions { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .fj-app .fj-directory :where(thead) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .fj-app .fj-directory :where(tbody, tr, td) { display: block; width: 100%; }
  .fj-app .fj-directory tr { border-bottom: 1px solid var(--fj-border); padding: 8px 0; }
  .fj-app .fj-directory td { border: 0; padding: 4px 12px; text-align: left; }
  .fj-app .fj-directory td.fj-number { text-align: left; }
  .fj-app .fj-directory td[data-label]::before { content: attr(data-label) ': '; font-weight: 600; }
}

.fj-app:has(dialog[open]) { overflow: hidden; }

/* Panel anatomy shared by account and record compositions. */
.fj-app .fj-panel-heading { margin: -20px -20px 16px; padding: 12px 18px; border-bottom: 1px solid var(--fj-border); }
.fj-app .fj-panel-heading h2 { margin: 0; font-size: 15px; }
.fj-app .fj-panel-heading p { margin: 3px 0 0; font-size: 11.5px; color: var(--fj-muted); }
.fj-app .fj-button--destructive-text { color: var(--fj-error); }
@media (max-width: 719px) {
  .fj-app .fj-page-header > .fj-button { width: 100%; }
}


.fj-app .fj-notice--info { background: var(--fj-action-soft); border-color: #d8def9; color: #27306f; font-size: 13px; }
.fj-app .fj-verify-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.fj-app .fj-verify-banner form { margin: 0; }

/* Immediate press; only release and selection colors ease. Focus is never delayed. */
.fj-app :is(.fj-button, .fj-menu-toggle, summary, .fj-public-header nav a, .fj-contents a) {
  transition: background-color var(--fj-motion-action) ease-out, border-color var(--fj-motion-action) ease-out, color var(--fj-motion-action) ease-out;
}
.fj-app :is(.fj-button, .fj-menu-toggle, summary):active:not(:disabled):not([aria-disabled=true]),
.fj-app :is(.fj-public-header nav a, .fj-contents a):active:not(:disabled):not([aria-disabled=true]) {
  background: #e3e3df; border-color: #c4c4be; transition-duration: 0s;
}
.fj-app .fj-button.fj-button--primary:active:not(:disabled):not([aria-disabled=true]) {
  background: #303e96; border-color: #303e96; color: white;
}
.fj-app .fj-button.fj-button--danger:active:not(:disabled):not([aria-disabled=true]) {
  background: #76221d; border-color: #76221d; color: white;
}
.fj-app .fj-button.fj-button--destructive-text:active:not(:disabled):not([aria-disabled=true]) {
  background: var(--fj-error-soft); border-color: var(--fj-error);
}
.fj-app :is(.fj-choice, .fj-input, .fj-billing-choice, .fj-field input, .fj-field select, .fj-field textarea) {
  transition: background-color var(--fj-motion-action) ease-out, border-color var(--fj-motion-action) ease-out;
}
.fj-app .fj-choice:has(:disabled) { cursor: default; }
.fj-app .fj-button[aria-busy=true] { opacity: 1; cursor: progress; white-space: normal; overflow-wrap: anywhere; }

/* Native details owns visibility and focus; menus only animate on entrance. */
@keyframes fj-menu-enter {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}
.fj-app .fj-menu[open] > .fj-menu-panel,
.fj-app .fj-account-menu[open] > .fj-account-links {
  animation: fj-menu-enter var(--fj-motion-menu) var(--fj-motion-enter-ease);
}
.fj-app [data-menu-chevron] {
  display: inline-block;
  transition: transform var(--fj-motion-action) ease-out;
}
.fj-app details[open] > summary [data-menu-chevron] { transform: rotate(180deg); }

/* Require both discrete transitions and top-layer retention. */
@supports (transition-behavior: allow-discrete) and (overlay: auto) {
  .fj-app .fj-dialog {
    --fj-dialog-offset: translateY(6px);
    opacity: 0;
    transform: var(--fj-dialog-offset);
    transition: opacity var(--fj-motion-exit) var(--fj-motion-exit-ease),
      transform var(--fj-motion-exit) var(--fj-motion-exit-ease),
      display var(--fj-motion-exit) allow-discrete,
      overlay var(--fj-motion-exit) allow-discrete;
  }
  .fj-app .fj-sheet { --fj-dialog-offset: translateX(16px); }
  .fj-app .fj-dialog[open] {
    opacity: 1;
    transform: none;
    transition-duration: var(--fj-motion-panel);
    transition-timing-function: var(--fj-motion-enter-ease);
  }
  .fj-app .fj-dialog:not([open]),
  .fj-app .fj-dialog:not([open])::backdrop { pointer-events: none; }
  .fj-app .fj-dialog::backdrop {
    opacity: 0;
    transition: opacity var(--fj-motion-exit) var(--fj-motion-exit-ease),
      display var(--fj-motion-exit) allow-discrete,
      overlay var(--fj-motion-exit) allow-discrete;
  }
  .fj-app .fj-dialog[open]::backdrop {
    opacity: 1;
    transition-duration: var(--fj-motion-panel);
    transition-timing-function: var(--fj-motion-enter-ease);
  }
  @starting-style {
    .fj-app .fj-dialog[open] { opacity: 0; transform: var(--fj-dialog-offset); }
    .fj-app .fj-dialog[open]::backdrop { opacity: 0; }
  }
}

/* Positioned menus never inherit intrinsic-height or clipping rules. */
@supports selector(details::details-content) and (interpolate-size: allow-keywords) and (transition-behavior: allow-discrete) and (content-visibility: hidden) {
  .fj-app :is(.fj-record-details, [data-reading-contents]) {
    interpolate-size: allow-keywords;
  }
  .fj-app :is(.fj-record-details, [data-reading-contents])::details-content {
    block-size: 0;
    overflow: clip;
    content-visibility: hidden;
  }
  .fj-app :is(.fj-record-details, [data-reading-contents])[open]::details-content {
    block-size: auto;
    overflow: visible;
    content-visibility: visible;
  }
  .fj-app :is(.fj-record-details, [data-reading-contents][data-motion-ready])[open]::details-content {
    transition: block-size var(--fj-motion-panel) var(--fj-motion-enter-ease),
      content-visibility var(--fj-motion-panel) allow-discrete;
  }
  /* Closing stays instant: links must leave keyboard navigation immediately. */
  .fj-app :is(.fj-record-details, [data-reading-contents])[open][data-fj-focus-reveal]::details-content,
  .fj-app :is(.fj-record-details, [data-reading-contents])[open]:has(> summary:focus-visible)::details-content,
  .fj-app :is(.fj-record-details, [data-reading-contents])[open]:has(:focus):not(:has(> summary:focus))::details-content {
    transition: none;
  }
}

/* Dynamic feedback keeps its existing live region and persistent text. */
@keyframes fj-feedback-enter { from { opacity: .45; } to { opacity: 1; } }
.fj-app .fj-notice--dynamic { animation: fj-feedback-enter var(--fj-motion-menu) var(--fj-motion-enter-ease); }
.fj-app .fj-field--revealed { animation: fj-feedback-enter var(--fj-motion-menu) var(--fj-motion-enter-ease); }

@keyframes fj-contact-confirmed { from { background-color: var(--fj-success-soft); } to { background-color: transparent; } }
.fj-app .fj-contact--confirmed { animation: fj-contact-confirmed 900ms var(--fj-motion-exit-ease); }
