/* Shared reader/author controls. Keep native select semantics and specialised listboxes. */
:is(.ah-shell,.ahb-main,.ah-offline){
  --ah-ui-select-arrow:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23194637' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --ah-ui-control-border:#7b8a78;
}
:is(.ah-shell,.ahb-main,.ah-offline)[data-appearance=dark],
:is(.ah-shell,.ahb-main,.ah-offline) [data-appearance=dark]{
  --ah-ui-select-arrow:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23bcd8aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --ah-ui-control-border:#71866f;
}
:is(.ah-shell,.ahb-main,.ah-offline) select:not([multiple]):not([size]):not(.select2-hidden-accessible):not([hidden]){
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  box-sizing:border-box;
  width:100%;
  max-width:100%;
  min-width:0;
  height:48px;
  min-height:48px;
  padding:0 40px 0 12px;
  border:1px solid var(--ah-ui-control-border);
  border-radius:6px;
  background-color:var(--ah-panel,var(--panel,#fffdf5));
  background-image:var(--ah-ui-select-arrow);
  background-repeat:no-repeat;
  background-position:right 12px center;
  background-size:16px;
  color:var(--ah-ink,var(--ink,#213e31));
  font-family:inherit;
  font-size:16px;
  font-weight:400;
  line-height:1.25;
  vertical-align:middle;
  box-shadow:none;
}
:is(.ah-shell,.ahb-main,.ah-offline) [data-appearance=dark] select,
.ah-offline[data-appearance=dark] select{color-scheme:dark}
:is(.ah-shell,.ahb-main,.ah-offline) select:not([multiple]):not([size]):not(.select2-hidden-accessible):focus-visible{
  outline:2px solid var(--ah-brass,#806326);
  outline-offset:2px;
  box-shadow:none;
}
:is(.ah-shell,.ahb-main,.ah-offline) select:disabled{cursor:not-allowed;opacity:.65}
:is(.ah-shell,.ahb-main,.ah-offline) select[aria-invalid=true]{--ah-ui-control-border:#8b4933}
/* Reader controls previously used narrow 13px labels; keep their 16px choices legible. */
.ah-shell .ah-reader-tools label{min-width:min(100%,140px)}
/* Adjacent one-line fields/actions share the select baseline; wrapped labels/actions can grow. */
:is(.ah-catalog-filters,.ah-lore-filters,.ah-shelf-search,.ah-search-filters,.ahb-filters,.ah-discussion-limit,.ah-assistance-picker,.ahb-own-filter,.ahb-admin-filter) input:is([type=search],[type=text],[type=number],:not([type])){
  box-sizing:border-box;
  height:48px;
  min-height:48px;
  min-width:0;
  max-width:100%;
  padding-block:0;
  font-size:16px;
  line-height:1.25;
}
:is(.ah-catalog-filters,.ah-lore-filters,.ah-shelf-search,.ah-search-filters,.ahb-filters,.ah-discussion-limit,.ah-assistance-picker,.ahb-own-filter,.ahb-admin-filter) :is(.ah-button,button[type=submit]){
  box-sizing:border-box;
  height:auto;
  min-height:48px;
  padding-block:10px;
  font-size:16px;
  line-height:1.25;
}
@media(max-width:480px){
  /* Give long Malay sorting/filter choices room without shrinking their type. */
  .ah-shell .ah-catalog-filters{display:grid;grid-template-columns:minmax(0,1fr)}
  .ah-shell .ah-catalog-filters>label{min-width:0;width:100%}
}
@media(forced-colors:active){
  :is(.ah-shell,.ahb-main,.ah-offline) select:not([multiple]):not([size]):not(.select2-hidden-accessible){
    appearance:auto;
    -webkit-appearance:auto;
    background-image:none;
    border-color:ButtonText;
    color:CanvasText;
    background-color:Canvas;
  }
}

/* One form hierarchy for our reader, author, community and offline interfaces. */
:is(.ah-shell,.ahb-main,.ah-offline,.aha-workspace,.aha-forum-workspace){
  --ah-ui-field-label:14px;
  --ah-ui-choice-label:16px;
  --ah-ui-help-size:14px;
  --ah-ui-check-size:20px;
}
:is(.ah-shell,.ahb-main) :is(.ah-form,.ahb-form,.ah-shared-manager form){row-gap:16px}
:is(.ah-shell,.ahb-main) :is(.ah-form,.ahb-form,.ah-shared-manager form)>label,
.ahb-main .ahb-compose-grid>label,
.ahb-main .ahb-upload-item>label,
.ah-shell .ah-reader-tools>label,
.ah-offline .help label,
.ah-offline .range-fields>label{
  font-family:inherit;
  font-size:var(--ah-ui-field-label);
  font-weight:500;
  line-height:1.5;
}
.ah-shell :is(.ah-catalog-filters,.ah-search-filters,.ah-bookmark-tools,.ah-bookmark-filters,.ah-lore-filters,.ah-shelf-filters,.ah-discussion-limit,.ah-assistance-picker) label:not(:has(>input[type=checkbox])),
.ahb-main .ahb-filters>label{
  font-size:var(--ah-ui-field-label);
  font-weight:500;
  line-height:1.5;
}
:is(.ah-shell,.ahb-main) :is(.ah-form,.ahb-form,.ah-shared-manager form) :is(input,select,textarea):not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]),
.ah-offline .range-fields>input{
  font-family:inherit;
  font-size:16px;
  font-weight:400;
}
:is(.ah-shell,.ahb-main) :is(.ah-form,.ahb-form,.ah-shared-manager form)>:is(p.ah-muted,p.ah-settings-note,small),
.ah-shell .ah-settings-note,
.ah-shell .ah-reader-tools>.ah-muted,
.ahb-main .ahb-form>p,
.ahb-main .ahb-upload>p{
  font-size:var(--ah-ui-help-size);
  line-height:1.5;
}
:is(.ah-shell,.ahb-main) :is(.ah-form,.ahb-form,.ah-shared-manager form)>:is(.ah-button,button.ah-button){
  font-size:16px;
  line-height:1.5;
}
/* Native inputs retain their values, validation, keyboard and touch behaviour. */
:is(.ah-shell,.ahb-main,.ah-offline,.aha-workspace,.aha-forum-workspace)
:is(label.ah-check,label.ahb-check,label.ah-shelf-unread,label.ah-swipe-choice,label.aha-choice,label.choose,.ah-form label:has(>input[type=checkbox]),.ahb-form label:has(>input[type=checkbox])){
  display:flex;
  align-items:flex-start;
  gap:12px;
  min-width:0;
  min-height:44px;
  box-sizing:border-box;
  margin:0;
  padding-block:8px;
  font-family:inherit;
  font-size:var(--ah-ui-choice-label);
  font-weight:400;
  line-height:24px;
  cursor:pointer;
}
:is(.ah-shell,.ahb-main,.ah-offline,.aha-workspace,.aha-forum-workspace)
:is(label.ah-check,label.ahb-check,label.ah-shelf-unread,label.ah-swipe-choice,label.aha-choice,label.choose,.ah-form label:has(>input[type=checkbox]),.ahb-form label:has(>input[type=checkbox]))>input[type=checkbox]{
  appearance:auto;
  -webkit-appearance:auto;
  flex:0 0 var(--ah-ui-check-size);
  box-sizing:border-box;
  width:var(--ah-ui-check-size);
  min-width:var(--ah-ui-check-size);
  max-width:var(--ah-ui-check-size);
  height:var(--ah-ui-check-size);
  min-height:var(--ah-ui-check-size);
  margin:2px 0 0;
  padding:0;
  font:inherit;
  accent-color:var(--ah-green,var(--accent,#24503e));
  box-shadow:none;
  cursor:inherit;
}
:is(.ah-shell,.ahb-main,.ah-offline,.aha-workspace,.aha-forum-workspace)
:is(label.ah-check,label.ahb-check,label.ah-shelf-unread,label.ah-swipe-choice,label.aha-choice,label.choose,.ah-form label:has(>input[type=checkbox]),.ahb-form label:has(>input[type=checkbox]))>input[type=checkbox]:focus-visible{
  outline:2px solid var(--ah-brass,#8b712e);
  outline-offset:3px;
  box-shadow:none;
}
:is(.ah-shell,.ahb-main,.ah-offline,.aha-workspace,.aha-forum-workspace)
:is(label.ah-check,label.ahb-check,label.ah-shelf-unread,label.ah-swipe-choice,label.aha-choice,label.choose)>:is(span,.ah-choice-copy){
  flex:1 1 auto;
  min-width:0;
  line-height:24px;
  overflow-wrap:anywhere;
}
:is(.ah-shell,.ahb-main,.ah-offline,.aha-workspace,.aha-forum-workspace)
:is(label.ah-check,label.ahb-check,label.ah-swipe-choice,label.aha-choice,label.choose) small{
  display:block;
  margin-top:4px;
  font-size:var(--ah-ui-help-size);
  font-weight:400;
  line-height:21px;
  color:var(--ah-muted,var(--ink,#536353));
}
:is(.ah-shell,.ahb-main,.ah-offline,.aha-workspace,.aha-forum-workspace)
:is(label.ah-check,label.ahb-check,label.ah-shelf-unread,label.ah-swipe-choice,label.aha-choice,label.choose):has(>input:disabled){cursor:default}
/* Filter labels stay compact, with the same native checkbox and usable row. */
.ah-shell .ah-shelf-filters label.ah-shelf-unread:has(>input[type=checkbox]){font-size:14px;line-height:21px}
.ah-shell .ah-shelf-filters label.ah-shelf-unread:has(>input[type=checkbox])>input[type=checkbox]{margin-top:.5px}
.ah-shell .ah-shelf-filters label.ah-shelf-unread:has(>input[type=checkbox])>span{line-height:21px}
/* Replace WordPress's drawn tick only inside our branded preference rows. */
:is(.aha-workspace,.aha-forum-workspace)
:is(label.aha-choice,label.ah-check,label.ahb-check)>input[type=checkbox]::before{content:none}
@media(forced-colors:active){
  :is(.ah-shell,.ahb-main,.ah-offline,.aha-workspace,.aha-forum-workspace)
  :is(label.ah-check,label.ahb-check,label.ah-shelf-unread,label.ah-swipe-choice,label.aha-choice,label.choose)>input[type=checkbox]{accent-color:auto}
}
