/* Shared, accessible controls used by the application, including new editors. */
:root { --accent:#69552e; --muted:#65615a; --danger:#a52d35; }
@media screen {
  #detail { overflow-anchor:none; scroll-behavior:auto; }
  button { min-height:44px; max-width:100%; border-radius:5px; line-height:1.35; touch-action:manipulation; }
  dialog form>button { min-height:44px; }
  button:not(:disabled):active { transform:translateY(1px); }
  button.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
  button.primary:hover:not(:disabled) { background:#534324; border-color:#534324; }
  button.danger { color:var(--danger); border-color:#c8999c; background:#fff; }
  button.danger:hover:not(:disabled) { background:#fff1f1; }
  button.primary.danger { background:var(--danger); color:#fff; border-color:var(--danger); }
  button:disabled { opacity:1; color:#6b665e; background:#eeebe5; border-color:#d6d0c6; cursor:not-allowed; }
  button[aria-busy=true] { cursor:progress; }
  button[aria-busy=true]::after { content:''; display:inline-block; width:13px; height:13px; margin-left:8px; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; vertical-align:-2px; animation:control-spin .85s linear infinite; }
  :is(button,a,input,select,textarea,summary):focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
  :is(input,select,textarea) { border-radius:5px; min-width:0; }
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select { min-height:44px; }
  textarea { line-height:1.55; }
  .actions { display:flex; flex-wrap:wrap; gap:10px; }
  .actions>button,.toolbar>button,.heading-actions>button { white-space:normal; overflow-wrap:anywhere; }
  .form-row>* { min-width:0; }
  .my-roles-toolbar { display:flex; flex-wrap:wrap; gap:12px; align-items:end; }
  .my-roles-toolbar>* { min-width:0; max-width:100%; }
  .my-role-own { border-left:3px solid var(--accent); padding-left:12px; }
  dialog .dialog-head { gap:16px; }
  dialog .dialog-head>div { min-width:0; }
  dialog .dialog-head>button { min-width:44px; min-height:44px; flex-shrink:0; }
  dialog h2 { overflow-wrap:anywhere; }
  dialog form>.actions,dialog .editor-actionbar { background:#fff; padding:14px 0; border-top:1px solid var(--line); }
  dialog form>.actions { position:sticky; bottom:-24px; z-index:3; margin-bottom:-8px; box-shadow:0 -6px 12px #fff; }
  .form-error:empty { display:none; }
  .form-error:not(:empty) { color:var(--danger); overflow-wrap:anywhere; }
  .pill,.badge { line-height:1.45; white-space:normal; }
  .unsaved-dialog { width:min(480px,calc(100vw - 32px)); height:fit-content; inset:0; margin:auto; max-height:calc(100dvh - 32px); }
  .unsaved-dialog h2 { margin-top:0; }
  .unsaved-dialog .actions { margin:24px 0 0; }
  .source-warning { margin:12px 0; border-left:3px solid #956a20; background:#fff8e9; padding:12px 14px; line-height:1.55; }
  [aria-invalid=true] { border-color:var(--danger); box-shadow:0 0 0 1px var(--danger); }
  #candidate-search-form fieldset { border:1px solid var(--line); padding:12px 16px; margin:16px 0; border-radius:5px; }
  #candidate-search-form { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px 24px; }
  #candidate-search-form>p,#candidate-search-form>.form-row,#candidate-search-form>.actions,#candidate-search-form>label:has(select[multiple]),#candidate-search-form>label:has(input[type=checkbox]) { grid-column:1/-1; }
  #candidate-search-form input[type=checkbox] { width:20px; height:20px; min-width:20px; flex:0 0 20px; margin:0; }
  #candidate-search-form>label:has(input[type=checkbox]) { display:flex; align-items:center; gap:10px; }
  #candidate-search-form fieldset label { display:inline-flex; align-items:center; gap:8px; margin:6px 20px 6px 0; }
  #candidate-search-form select[multiple] { min-height:130px; }
  .candidate-search-results { padding:0; list-style:none; }
  .candidate-search-results>li { padding:18px 0; border-bottom:1px solid var(--line); line-height:1.5; }
  .candidate-search-results>li>small { display:block; margin-top:8px; color:var(--muted); }
  .candidate-search-results>li>ul { padding-left:20px; margin-top:8px; }
  @media(min-width:761px) { body[data-viewer=staff] nav button { min-height:44px; } }
  @media(max-width:760px) {
    body[data-viewer=actor] #navigation { grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px; }
    body[data-viewer=actor] #navigation button { padding-inline:3px; overflow-wrap:anywhere; }
    #candidate-search-form { grid-template-columns:minmax(0,1fr); }
    button { min-height:46px; }
    dialog form>button { min-height:46px; }
    .toolbar { gap:10px; }
    .toolbar>label { min-width:0; max-width:100%; }
    dialog form>.actions { bottom:-18px; }
    dialog .actions>button { flex:1 1 145px; }
    .heading { align-items:flex-start; flex-direction:column; gap:12px; }
    .heading > div:first-child { flex:0 1 auto; }
    .heading-actions { flex-wrap:wrap; gap:8px; }
    .heading:has([data-candidate-search-open]) .heading-actions { width:100%; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px; }
    .heading-actions>[data-candidate-search-open] { grid-column:1/-1; }
  }
  @media(prefers-reduced-motion:reduce) { button[aria-busy=true]::after { animation:none; } button:not(:disabled):active { transform:none; } }
  @keyframes control-spin { to { transform:rotate(360deg); } }
}
