/* KhanAtlas shared search design contract, v1. No behavioral interception. */
:root{--ka-search-radius:999px;--ka-search-height:54px;--ka-search-border:#d8e2e9;--ka-search-ink:#273e39;--ka-search-shadow:0 2px 9px rgba(25,40,44,.12)}
.ka-search-row{display:flex;align-items:center;gap:5px;min-height:var(--ka-search-height);padding:5px 9px;border:1px solid var(--ka-search-border);border-radius:var(--ka-search-radius);background:#fff;box-shadow:var(--ka-search-shadow);color:var(--ka-search-ink)}
.ka-search-row input[type=search]{flex:1;min-width:0;width:0;padding:9px 10px;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:16px}
.ka-search-row .ka-search-tool{display:grid;place-items:center;flex:0 0 38px;width:38px;height:38px;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;font:inherit;font-size:21px}
.ka-search-row .ka-search-tool:focus-visible,.ka-search-row input:focus-visible{outline:2px solid #af884f;outline-offset:2px}
.ka-search-row .ka-search-tool[disabled]{opacity:.38;cursor:not-allowed}
@media(max-width:620px){.ka-search-row{gap:2px;padding:4px 6px}.ka-search-row .ka-search-tool{flex-basis:34px;width:34px;height:34px}}

/* Shared contract adapters: preserve existing page search behavior and controls. */
form.search.ka-search-row{border-radius:var(--ka-search-radius);min-height:var(--ka-search-height)}
form.search.ka-search-row input[type=search]{width:auto;min-width:0}
.tea-search-row.ka-search-row{flex-direction:row;flex-wrap:nowrap;border-radius:var(--ka-search-radius)}
.tea-search-row.ka-search-row input[type=search]{width:auto;min-width:0}
.tea-search-row.ka-search-row .tea-tool{flex:0 0 auto}
.tea-search-row.ka-search-row .tea-submit{flex:0 0 auto}
@media(max-width:600px){.tea-search-row.ka-search-row{flex-direction:row}.tea-search-row.ka-search-row button{width:auto}}

/* Accessibility and bidirectional safety for the shared search shell. */
.ka-search-row{max-width:100%;min-width:0}
.ka-search-row input[type=search]::placeholder{color:#526477;opacity:1}
.ka-search-row:focus-within{border-color:#8e723f;box-shadow:0 0 0 3px rgba(175,136,79,.22)}
.ka-search-row button:focus-visible{outline:2px solid #8e723f;outline-offset:2px}
[dir=rtl] .ka-search-row input[type=search]{text-align:start}
[dir=ltr] .ka-search-row input[type=search]{text-align:start}
@media(prefers-reduced-motion:reduce){.ka-search-row,.ka-search-row *{transition:none!important}}

/* Exchange uses a label search shell; keep its existing live filter behavior. */
label.search.ka-search-row{display:flex;align-items:center;border-radius:var(--ka-search-radius);min-height:var(--ka-search-height)}
label.search.ka-search-row input[type=search]{flex:1;min-width:0;width:0}


/* Final shared geometry: equal-height search shells without nested width collisions. */
.ka-search-row{display:flex!important;align-items:center!important;flex-wrap:nowrap!important;gap:6px!important;min-height:54px;max-width:100%;box-sizing:border-box;padding:5px 8px;border-radius:999px!important;overflow:visible}
.ka-search-row input[type="search"]{display:block;flex:1 1 auto!important;min-width:0!important;width:100%!important;max-width:100%;box-sizing:border-box;margin:0!important;padding:9px 12px!important;border:0!important;outline:0!important;background:transparent!important;box-shadow:none!important;line-height:1.35}
.ka-search-row input[type="search"]:focus{outline:0!important;box-shadow:none!important}
form.search.ka-search-row{width:100%;max-width:100%}
form.search.ka-search-row button[type="submit"]{flex:0 0 auto!important;min-width:0;white-space:nowrap}
.tea-search-row.ka-search-row{width:100%;max-width:100%;min-width:0}
.tea-search-row.ka-search-row>.tea-tool{flex:0 0 38px!important;min-width:38px!important}
.tea-search-row.ka-search-row .tea-search-actions{display:flex!important;align-items:center;flex:0 0 auto!important;gap:3px;min-width:0}
.tea-search-row.ka-search-row .tea-search-actions>.tea-tool{flex:0 0 38px!important;min-width:38px!important}
label.search.ka-search-row{width:100%;max-width:100%;cursor:text}
@media(max-width:620px){.ka-search-row{gap:3px!important;min-height:48px;padding:4px 6px}.ka-search-row input[type="search"]{font-size:16px!important;padding-inline:6px!important}.tea-search-row.ka-search-row>.tea-tool,.tea-search-row.ka-search-row .tea-search-actions>.tea-tool{flex-basis:32px!important;min-width:32px!important;width:32px!important;padding-inline:0!important}.tea-search-row.ka-search-row .tea-search-actions{gap:1px}form.search.ka-search-row button[type="submit"]{padding-inline:12px!important}}
/* Homepage-only adapter: match the Tea Khan search shell without changing behavior. */
body:has(#khans) form.search.ka-search-row{min-height:54px!important;padding:5px 8px!important;gap:6px!important;border:1px solid var(--ka-search-border)!important;border-radius:999px!important;box-shadow:var(--ka-search-shadow)!important;margin-top:25px}
body:has(#khans) form.search.ka-search-row input[type="search"]{min-height:42px!important;font-size:16px!important}
body:has(#khans) form.search.ka-search-row button[type="submit"]{min-height:40px;border-radius:999px;padding:8px 20px}
@media(max-width:620px){body:has(#khans) form.search.ka-search-row{min-height:48px!important;padding:4px 6px!important;gap:3px!important}body:has(#khans) form.search.ka-search-row button[type="submit"]{min-height:38px;padding-inline:12px}}
/* Approved Khan sequence: Tea, Saffron, Honey, Grains. */
#khans .cards{gap:clamp(12px,1.5vw,20px);align-items:stretch}
#khans .card{min-width:0;display:flex;flex-direction:column}
/* Khan order follows DOM order for keyboard and assistive technology. */
#khans .cardbody{flex:1;min-width:0}#khans .cardbody h3{line-height:1.4}#khans .cardbody p{line-height:1.65}
@media(max-width:620px){#khans .cards{gap:12px}}

/* Match the shared Tea search geometry, without touching its buttons or handlers. */
body:has(#khans) form.search.ka-search-row{box-sizing:border-box;min-height:var(--ka-search-height)!important;padding:5px 9px!important;gap:5px!important;border-radius:var(--ka-search-radius)!important}
body:has(#khans) form.search.ka-search-row input[type=search]{min-height:42px;line-height:1.4}
@media(max-width:620px){body:has(#khans) form.search.ka-search-row{padding:4px 6px!important;gap:3px!important}}

/* Review v2: homepage search matches Tea's controls and shell. */
body:has(#khans) form.ka-home-tea-search{display:flex!important;align-items:center!important;max-width:710px!important;width:100%!important;min-height:60px!important;padding:5px 8px!important;border-radius:999px!important;background:#fff!important;gap:5px!important;box-shadow:0 3px 12px #10283b22!important}
body:has(#khans) .ka-home-tea-search input[type=search]{flex:1 1 auto!important;width:0!important;min-width:0!important;min-height:44px!important;padding:7px 12px!important;color:#273e39!important;background:transparent!important}
body:has(#khans) .ka-home-tea-search .ka-home-search-actions{display:flex;align-items:center;gap:3px;flex:0 0 auto}
body:has(#khans) .ka-home-tea-search button.ka-search-tool{display:grid!important;place-items:center!important;flex:0 0 40px!important;width:40px!important;height:40px!important;min-height:40px!important;padding:0!important;border:0!important;border-radius:50%!important;background:transparent!important;color:#25483b!important;box-shadow:none!important;line-height:1!important}
body:has(#khans) .ka-home-tea-search button.ka-submit{background:#e8f0eb!important}
body:has(#khans) .ka-home-tea-search button.ka-search-tool[disabled]{opacity:.45!important;cursor:not-allowed!important}
body:has(#khans) .ka-home-tea-search button.ka-voice[aria-pressed=true]{background:#d9ebe2!important}
@media(max-width:620px){body:has(#khans) form.ka-home-tea-search{min-height:52px!important;padding:4px!important;gap:2px!important}body:has(#khans) .ka-home-tea-search button.ka-search-tool{flex-basis:33px!important;width:33px!important;height:33px!important;min-height:33px!important}body:has(#khans) .ka-home-tea-search input[type=search]{min-height:40px!important;padding-inline:5px!important}}

/* Review v4: page-specific search surface; shared geometry and functionality unchanged. */
body:has(#khans){--ka-home-search-surface:#eaf0f4;--ka-home-search-border:#cbd9e4;--ka-home-search-action:#d7e4ed;--ka-home-search-ink:#163a4c}
body:has(#khans) form.ka-home-tea-search{background:var(--ka-home-search-surface)!important;border-color:var(--ka-home-search-border)!important;color:var(--ka-home-search-ink)!important}
body:has(#khans) .ka-home-tea-search input[type=search]{color:var(--ka-home-search-ink)!important}
body:has(#khans) .ka-home-tea-search input[type=search]::placeholder{color:#526d7c!important}
body:has(#khans) .ka-home-tea-search button.ka-search-tool{color:var(--ka-home-search-ink)!important}
body:has(#khans) .ka-home-tea-search button.ka-submit{background:var(--ka-home-search-action)!important}
html[data-theme=dark] body:has(#khans){--ka-home-search-surface:#263d50;--ka-home-search-border:#526b7c;--ka-home-search-action:#3c5b70;--ka-home-search-ink:#eaf4fa}
html[data-theme=dark] body:has(#khans) .ka-home-tea-search input[type=search]::placeholder{color:#c2d1dc!important}
