.ah-search-dialog, .ah-search-page {
    color: #333;
    font: 16px/1.45 "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.ah-search-dialog *, .ah-search-page *, .ah-natural-query * { box-sizing: border-box; }
.ah-search-dialog {
    box-sizing: border-box;
    width: min(600px, calc(100% - 24px));
    max-height: calc(100dvh - 36px);
    margin: auto;
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border: 1px solid #999;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgb(0 0 0 / 45%);
    text-align: left;
}
.ah-search-dialog:not([open]) { display: none; }
.ah-search-dialog::backdrop { background: rgb(0 0 0 / 50%); }
body:has(.ah-search-dialog[open]) { overflow: hidden; }
.ah-dialog-heading {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; border-bottom: 1px solid #ddd;
}
.ah-dialog-heading h2 {
    margin: 0; padding: 0; border: 0; background: transparent; color: #333;
    font: 500 22px/1.2 "Helvetica Neue", Helvetica, Arial, sans-serif;
    text-indent: 0; letter-spacing: normal;
}
.ah-dialog-close {
    width: 38px; height: 38px; border: 0; background: transparent;
    color: #555; font: bold 28px/1 Arial, sans-serif; cursor: pointer;
}
.ah-dialog-body { padding: 18px 20px 22px; }
.ah-natural-query { position: relative; max-width: 600px; margin: 0 auto; text-align: left; }
.ah-natural-query .ah-query-row { display: flex; width: 100%; }
.ah-natural-query .ah-query-row input {
    flex: 1 1 auto; min-width: 0; width: 100%; height: 46px; margin: 0;
    padding: 10px 14px; border: 1px solid #aaa; border-radius: 4px 0 0 4px;
    background: white; color: #333; font: 16px/1.45 "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.ah-natural-query .input-group-btn { display: flex; width: auto; }
.ah-natural-query .ah-query-row button, .ah-results .ah-continue {
    padding: 9px 16px; border: 1px solid #2e6da4; background: #337ab7; color: #fff;
    font: 500 16px/1.45 "Helvetica Neue", Helvetica, Arial, sans-serif; cursor: pointer;
}
.ah-natural-query .ah-query-row button { height: 46px; margin: 0; border-radius: 0 4px 4px 0; }
.ah-natural-query .ah-query-row button:hover, .ah-results .ah-continue:hover { background: #286090; }
.ah-query-label { display: block; font-weight: 600; margin-bottom: 6px; }
.ah-model-options {
    position: absolute; z-index: 1010; left: 0; right: 0; top: 100%;
    max-height: min(18rem, 35vh); overflow: auto; border: 1px solid #bbb;
    border-radius: 0 0 4px 4px; background: #fff; box-shadow: 0 3px 8px rgb(0 0 0 / 15%);
}
.ah-model-options[hidden] { display: none; }
.ah-model-options button {
    display: block; width: 100%; padding: 8px 12px; border: 0; border-bottom: 1px solid #eee;
    background: #fff; color: #333; text-align: left; font: 16px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.ah-model-options button:hover, .ah-model-options button[aria-selected=true] { background: #eaf2f8; }
.ah-visually-hidden, .ah-option input {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.ah-results:empty { display: none; }
.ah-results:focus { outline: 0; }
.ah-results .ah-context, .ah-results .ah-search-notice {
    margin: 14px 0 0; padding: 0; text-align: start; text-indent: 0; letter-spacing: normal;
}
.ah-results .ah-context { font-weight: 600; }
.ah-results .ah-search-notice { padding: 8px 12px; background: #f5f5f5; border-left: 3px solid #777; }
.ah-results .ah-picker { margin: 16px 0 0; }
.ah-results .ah-picker:not([data-selected]), .ah-results .ah-year-picker { margin-inline-start: 24px; }
.ah-picker summary { display: list-item; cursor: pointer; font-weight: 600; color: #333; }
.ah-picker[data-selected] summary { color: #23527c; }
.ah-option-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 3px 4px; max-height: 260px; overflow-y: auto; }
.ah-option { position: relative; display: inline-flex; min-width: 0; max-width: 100%; margin: 0; cursor: pointer; }
.ah-option-face {
    display: inline-block; max-width: 100%; padding: 8px 12px; min-height: 38px;
    overflow-wrap: anywhere; border: 1px solid #aaa; border-radius: 4px; background: #fff;
    color: #333; font-weight: 400; line-height: 1.35;
}
.ah-option:hover .ah-option-face { background: #f2f2f2; border-color: #888; }
.ah-option input:checked + .ah-option-face { color: #fff; background: #337ab7; border-color: #2e6da4; }
.ah-option input:checked + .ah-option-face::before { content: "✓ "; font-weight: 700; }
.ah-option input:focus-visible + .ah-option-face, .ah-picker summary:focus-visible,
.ah-natural-query :focus-visible, .ah-results button:focus-visible, .ah-dialog-close:focus-visible { outline: 2px solid #23527c; outline-offset: 2px; }
.ah-year-picker { margin-top: 16px; }
.ah-year-picker label { display: block; margin-bottom: 4px; font-weight: 600; }
.ah-year-picker select { max-width: 12em; padding: 6px; border: 1px solid #aaa; border-radius: 4px; color: #333; background: white; font: inherit; }
.ah-results .ah-continue { margin: 18px 0 0; border-radius: 4px; }
.ah-result-title { margin-top: 18px; font-size: 18px; }
.ah-result-link, .ah-results [data-natural-page] { display: block; padding: 8px 0; color: #23527c; }
.ah-result-link { border-bottom: 1px solid #ddd; }
.ah-search-page { margin: 0; background: #fff; }
.ah-search-page header { background: #3f3f3f; border-bottom: 1px solid #666; padding: 14px max(16px, calc((100% - 600px)/2)); }
.ah-search-page header a { color: #fff; font-weight: 600; text-decoration: none; }
.ah-search-page main { max-width: 632px; margin: 24px auto; padding: 0 16px; }
.ah-search-page h1 { margin: 0 0 14px; font-size: 26px; }
@media (max-width: 480px) {
    .ah-dialog-body { padding: 14px; }
    .ah-dialog-heading { padding: 8px 14px; }
    .ah-option-face { min-height: 44px; }
}
@media print { .ah-search-dialog { display: none; } }
