/* Searchable dropdowns (Tom Select) in the An-Nikah style */
.ts-wrapper.ah-ts { --ts-accent: #0f5c46; --ts-accent-soft: rgba(15, 92, 70, .08); --ts-line: rgba(11, 59, 46, .18); --ts-ink: #1b2420; position: relative; width: 100%; }
.ts-wrapper.ah-ts.single .ts-control, .ts-wrapper.ah-ts.multi .ts-control {
    min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 38px 8px 14px !important;
    border: 1px solid var(--ts-line) !important; border-radius: 12px !important; background: #fff !important; box-shadow: none !important;
    font: inherit; font-size: .95rem; color: var(--ts-ink); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.ts-wrapper.ah-ts.single .ts-control::after {
    content: ""; position: absolute; right: 15px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
    border-right: 2px solid #66706b; border-bottom: 2px solid #66706b; transform: rotate(45deg); transition: transform .15s; border-top: 0 !important; border-left: 0 !important;
}
.ts-wrapper.ah-ts.single.dropdown-active .ts-control::after { transform: rotate(-135deg); margin-top: -2px; }
.ts-wrapper.ah-ts:hover .ts-control { border-color: var(--ts-accent) !important; }
.ts-wrapper.ah-ts.focus .ts-control { border-color: var(--ts-accent) !important; box-shadow: 0 0 0 3px rgba(15, 92, 70, .14) !important; }
/* the search box sits in the open list (dropdown_input): hide the one in the field */
.ts-wrapper.ah-ts.single.plugin-dropdown_input .ts-control input:not(.items-placeholder) { display: none !important; }
/* dropdowns set up by pages without that plugin search inside the field: show it cleanly */
.ts-wrapper.ah-ts.single:not(.plugin-dropdown_input) .ts-control input { flex: 1 1 60px; min-width: 60px; margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; outline: 0 !important; font: inherit; color: var(--ts-ink); }
.ts-wrapper.ah-ts.single:not(.plugin-dropdown_input).dropdown-active .ts-control > .item { opacity: .45; }
/* "Select…" when nothing is chosen (hidden once a choice is shown) */
.ts-wrapper.ah-ts .ts-control .items-placeholder { display: block; width: 100%; min-width: 0; margin: 0; padding: 0; border: 0; background: none; outline: 0; font: inherit; color: #8a948f; pointer-events: none; box-shadow: none; }
.ts-wrapper.ah-ts .ts-control .items-placeholder::placeholder { color: #8a948f; opacity: 1; }
.ts-wrapper.ah-ts.has-items .ts-control .items-placeholder { display: none !important; }
.ts-wrapper.ah-ts .ts-control .item { color: var(--ts-ink); }
.ts-wrapper.ah-ts.single .ts-control > .item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ts-wrapper.ah-ts.disabled .ts-control { opacity: .6; cursor: not-allowed; background: #f4f4f2 !important; }
/* chosen items in multi-select */
.ts-wrapper.ah-ts.multi .ts-control > .item { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--ts-accent-soft); color: var(--ts-accent); font-weight: 600; font-size: .85rem; border: 0; }
.ts-wrapper.ah-ts.multi .ts-control > .item .remove { border: 0 !important; padding: 0 6px; border-radius: 999px; color: inherit; font-size: 1rem; text-decoration: none; }
.ts-wrapper.ah-ts.multi .ts-control > .item .remove:hover { background: rgba(15, 92, 70, .15); }
.ts-wrapper.ah-ts.multi .ts-control input { min-width: 6rem; border: 0; outline: 0; font: inherit; font-size: .9rem; }

/* the open list */
.ts-wrapper.ah-ts .ts-dropdown {
    z-index: 2100; margin-top: 6px; padding: 6px; border: 1px solid var(--ts-line); border-radius: 14px; background: #fff;
    box-shadow: 0 24px 50px -20px rgba(11, 59, 46, .45); overflow: hidden; animation: ahTsIn .12s ease-out;
}
@keyframes ahTsIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.ts-wrapper.ah-ts .ts-dropdown .dropdown-input-wrap { position: relative; padding: 2px 2px 6px; }
.ts-wrapper.ah-ts .ts-dropdown .dropdown-input-wrap::before {
    content: ""; position: absolute; left: 13px; top: 50%; width: 11px; height: 11px; margin-top: -8px; border: 2px solid #8a948f; border-radius: 50%;
}
.ts-wrapper.ah-ts .ts-dropdown .dropdown-input-wrap::after { content: ""; position: absolute; left: 24px; top: 50%; width: 6px; height: 2px; margin-top: 3px; background: #8a948f; transform: rotate(45deg); }
.ts-wrapper.ah-ts .ts-dropdown .dropdown-input {
    width: 100%; box-sizing: border-box; padding: 9px 12px 9px 34px; border: 1px solid var(--ts-line); border-radius: 10px; background: #f8faf8;
    font: inherit; font-size: .92rem; color: var(--ts-ink); outline: 0;
}
.ts-wrapper.ah-ts .ts-dropdown .dropdown-input:focus { border-color: var(--ts-accent); background: #fff; box-shadow: 0 0 0 3px rgba(15, 92, 70, .12); }
.ts-wrapper.ah-ts .ts-dropdown-content { max-height: 280px; overflow-y: auto; scrollbar-width: thin; }
.ts-wrapper.ah-ts .ts-dropdown .option {
    position: relative; padding: 9px 34px 9px 12px; border-radius: 9px; font-size: .92rem; color: var(--ts-ink); cursor: pointer; line-height: 1.35;
}
.ts-wrapper.ah-ts .ts-dropdown .option.active { background: var(--ts-accent-soft); color: var(--ts-accent); }
.ts-wrapper.ah-ts .ts-dropdown .option.selected { font-weight: 700; color: var(--ts-accent); }
.ts-wrapper.ah-ts .ts-dropdown .option.selected::after {
    content: ""; position: absolute; right: 14px; top: 50%; width: 5px; height: 10px; margin-top: -7px; border: solid var(--ts-accent); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.ts-wrapper.ah-ts .ts-dropdown .option[data-value=""] { color: #8a948f; }
.ts-wrapper.ah-ts .ts-dropdown .highlight { background: rgba(198, 164, 101, .35); border-radius: 3px; color: inherit; }
.ts-wrapper.ah-ts .ts-dropdown .no-results { padding: 12px; font-size: .88rem; color: #66706b; text-align: center; }
.ts-wrapper.ah-ts .ts-dropdown .optgroup-header { padding: 8px 12px 4px; font-size: .74rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #8a948f; }

/* keep the hidden native select accessible for form validation */
select.tomselected.ts-hidden-accessible { position: absolute !important; opacity: 0 !important; pointer-events: none; width: 1px !important; height: 1px !important; }
@media (max-width: 640px) { .ts-wrapper.ah-ts .ts-dropdown-content { max-height: 50vh; } }

/* the wrapper inherits the original field's classes (form-select etc.): only the inner control draws the box */
.ts-wrapper.ah-ts.form-select, .ts-wrapper.ah-ts.form-control, .ts-wrapper.ah-ts.form-input, .ts-wrapper.ah-ts.tom-select, .ts-wrapper.ah-ts.fi, .ts-wrapper.ah-ts[class*="select"] {
    border: 0 !important; padding: 0 !important; background: none !important; box-shadow: none !important; min-height: 0 !important; height: auto !important;
}

/* short lists: same look, no search box */
.ts-wrapper.ah-ts.ah-ts--short .ts-dropdown .dropdown-input-wrap { display: none; }
/* A select styled as a field (.fs / .fi) passes its classes to the wrapper: keep only the inner box's border, never two. */
.ts-wrapper.ah-ts.fs, .ts-wrapper.ah-ts.fi, .ts-wrapper.ah-ts.form-select, .ts-wrapper.ah-ts.form-control { padding: 0 !important; border: 0 !important; box-shadow: none !important; background: none !important; min-height: 0; height: auto; }
