/* Compact, table-like advanced search based on the clinic's existing workflow. */
body aside nav{grid-template-columns:repeat(8,minmax(0,1fr))}
.advanced-form{margin-bottom:20px}.advanced-form>.panel-head{padding:16px 18px;background:#f5eee4}
.advanced-form fieldset{border:0;border-top:1px solid #dfd2c3;margin:0;padding:14px 18px 18px}
.advanced-form legend{font-size:14px;font-weight:700;color:#754733;padding:0 8px}
.advanced-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0;border-left:1px solid #dbd0c4;border-top:1px solid #dbd0c4}
.advanced-fields>label,.advanced-check-row{display:flex;align-items:center;gap:10px;min-width:0;padding:7px 10px;background:linear-gradient(to right,#f2ede6 0,#f2ede6 100px,#fff 100px);border-bottom:1px solid #dbd0c4;border-right:1px solid #dbd0c4;font-size:13px;color:#796452}
.advanced-fields>label{display:grid;grid-template-columns:90px minmax(0,1fr)}
.advanced-fields input,.advanced-fields select{font-size:13px;padding:6px 8px;height:32px;width:100%;border-radius:3px}
.advanced-fields .advanced-range>span{display:flex;align-items:center;gap:6px;min-width:0}
.advanced-range i{font-style:normal;color:#998675}.advanced-fields .advanced-range>small{grid-column:2;font-size:12px;color:#998675}
.advanced-fields .advanced-wide,.advanced-check-row{grid-column:1/-1}
.advanced-check-row>span{flex:0 0 90px}.advanced-check-row>span small{font-size:10px;color:#a38765}
.advanced-check-row>div{display:flex;flex-wrap:wrap;gap:8px 15px;padding:3px 0}
.advanced-check-row label{display:inline-flex;gap:5px;align-items:center;white-space:nowrap;font-size:13px;color:#493e36}
.advanced-check-row input{width:15px;height:15px;margin:0;accent-color:#956550}
.advanced-help{font-size:12px;margin-top:10px;color:#958373}
.advanced-actions{display:flex;align-items:center;gap:8px;padding:0 18px 16px}.advanced-actions>span{font-size:12px;color:#986a44}
.advanced-results{margin-bottom:20px}.advanced-results>.panel-head{padding:16px 18px;gap:12px;flex-wrap:wrap}
.advanced-results>.panel-head p{font-size:12px}.advanced-results .table-wrap{max-height:650px;overflow:auto}
.advanced-table{min-width:1000px}.advanced-table thead th{position:sticky;top:0;z-index:1}.advanced-table td{white-space:nowrap}
.advanced-stats{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));margin:0 18px;gap:8px}
.advanced-stats>div{padding:10px;background:#f6f1e9;border:1px solid #e2d6c8;border-radius:4px}.advanced-stats span{display:block;font-size:12px;color:#8b7969}.advanced-stats strong{display:block;font-size:20px;color:#754733;margin-top:4px}.advanced-stats small{font-size:12px;font-weight:400;margin-left:3px}.advanced-stats>div:last-child{background:#eaf0df;border-color:#ced8bd}.advanced-stats>div:last-child strong{color:#52683e}
.advanced-export-note{font-size:12px;padding:12px 18px;color:#8b7969}.advanced-eligible{color:#52683e;font-weight:600}
@media(max-width:1000px){.advanced-stats{grid-template-columns:repeat(4,minmax(0,1fr))}.advanced-fields{grid-template-columns:1fr}}
@media(max-width:650px){body aside nav{grid-template-columns:repeat(4,minmax(0,1fr))}.advanced-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.advanced-form fieldset{padding:12px 10px}.advanced-fields>label{grid-template-columns:75px minmax(0,1fr);background:linear-gradient(to right,#f2ede6 0,#f2ede6 85px,#fff 85px)}.advanced-check-row>span{flex-basis:75px}.advanced-range>span{flex-wrap:wrap}}
@media(max-width:360px){body aside nav{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Search and sales utilities sit at the far right of the upper header row. */
body aside{grid-template-columns:48px minmax(180px,270px) max-content minmax(0,1fr) max-content}
body aside nav.top-utility-nav{grid-column:5;grid-row:1;display:flex;width:auto;gap:6px;justify-self:end;margin:0;overflow:visible}
body aside nav.top-utility-nav button{width:auto;min-width:84px;padding:8px 12px}
body aside nav.top-primary-nav{grid-column:1/-1;grid-row:2;grid-template-columns:repeat(6,minmax(0,1fr));width:100%}
body aside nav.top-primary-nav button span{font-size:13px}
@media(max-width:650px){body aside{grid-template-columns:42px minmax(0,1fr)}body aside nav.top-utility-nav{grid-column:1/-1;grid-row:3;justify-self:end}body aside nav.top-primary-nav{grid-row:4;grid-template-columns:repeat(3,minmax(0,1fr))}}

/* Clinic wordmark draws from the original burgundy and gold emblem. */
body aside{grid-template-columns:110px minmax(180px,270px) max-content minmax(0,1fr) max-content}
body aside .brand{width:110px;height:44px;background:#8d382e;border:2px solid #c89e36;border-radius:12px;box-shadow:inset 0 0 0 2px #a35443,0 2px 5px #51322225}
body aside .brand-caption{font-size:18px;font-weight:700;letter-spacing:-.7px;color:#fff5dc;white-space:nowrap}
body aside .brand[role="button"]:hover{background:#a14637;box-shadow:inset 0 0 0 2px #b36650,0 3px 8px #51322235}
@media(max-width:650px){body aside{grid-template-columns:100px minmax(0,1fr)}body aside .brand{width:100px;height:40px;border-radius:11px}body aside .brand-caption{font-size:16px}}

/* Consistent top-row controls and bottom-row menu rhythm. */
body aside{align-items:center;column-gap:10px;row-gap:10px;padding:12px 16px;grid-template-rows:40px auto}
body aside .brand{height:40px;border-radius:9px}
body aside .global-patient-search{height:40px;align-items:stretch;gap:6px}
body aside .global-patient-search input,body aside .global-patient-search button,body aside>#new-patient{height:40px;min-height:40px;box-sizing:border-box;border-radius:6px;margin:0;font-size:13px}
body aside .global-patient-search input{padding:8px 10px}
body aside .global-patient-search button,body aside>#new-patient{padding:8px 12px;display:flex;align-items:center;justify-content:center}
body aside nav.top-utility-nav{height:40px;align-items:stretch;gap:8px}
body aside nav.top-utility-nav button{height:40px;min-height:40px;border-radius:6px;padding:8px 14px;box-sizing:border-box}
body aside nav.top-utility-nav button span{font-size:13px}
body aside nav.top-primary-nav{gap:8px;align-items:stretch}
body aside nav.top-primary-nav button{height:38px;min-height:38px;padding:7px 8px;border-radius:6px;box-sizing:border-box}
body aside nav.top-primary-nav button span{font-size:13px;line-height:1.4}
@media(max-width:650px){body aside{padding:10px;gap:8px;grid-template-rows:auto}body aside .brand{height:40px}body aside>#new-patient{height:40px;min-height:40px}body aside nav.top-primary-nav{gap:6px}body aside nav.top-primary-nav button{height:38px}body aside nav.top-primary-nav button span{font-size:12px}}

body aside nav.top-primary-nav{grid-template-columns:repeat(5,minmax(0,1fr))}@media(max-width:650px){body aside nav.top-primary-nav{grid-template-columns:repeat(3,minmax(0,1fr))}}

.advanced-shortcuts{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:13px 18px;margin-bottom:12px;background:#fcf9f3;border-top:1px solid #e5d8c8;border-bottom:1px solid #e5d8c8}.advanced-shortcuts>span{font-size:13px;font-weight:600;color:#8a7159;margin-right:4px}.advanced-shortcuts button{font-size:13px;padding:8px 13px;border-color:#c8ac8b;color:#754733;background:#fff9ee}.advanced-shortcuts button:hover{background:#f0e2ce}.advanced-shortcuts button.active{background:#84503b;border-color:#84503b;color:#fff8ec;box-shadow:inset 0 -2px 0 #d8b877}.advanced-shortcuts small{font-size:12px;color:#9b8773}

.advanced-recipients{margin-top:20px;scroll-margin-top:125px}.advanced-recipients>.panel-head{padding:15px 18px;background:#f3eee5;gap:12px;flex-wrap:wrap}.advanced-recipients .panel-head p{font-size:12px}.advanced-recipients textarea{display:block;box-sizing:border-box;width:calc(100% - 36px);margin:14px 18px 18px;min-height:260px;max-height:650px;resize:vertical;padding:12px;font-family:Consolas,'Malgun Gothic',monospace;font-size:14px;line-height:1.7;background:#fffdf9;border:1px solid #d9cbbd;border-radius:4px;color:#362e2a;white-space:pre}

.recipient-actions{display:flex;gap:8px;align-items:center}

.advanced-result-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}

/* Distinct stages: conditions, results, accumulated recipients. */
body #advanced-view>.advanced-form,body #advanced-view>.advanced-results,body #advanced-view>.advanced-recipients{border-radius:8px;overflow:hidden;box-shadow:0 2px 7px #563b2c08;margin-bottom:28px}
body #advanced-view>.advanced-form{border:1px solid #cbb496;border-top:4px solid #a27c50}
body #advanced-view>.advanced-form>.panel-head{background:#f0e5d4;padding:17px 20px}
body #advanced-view>.advanced-form>.panel-head h2{color:#765431}
body #advanced-view>.advanced-results{border:1px solid #b7c6d4;border-top:4px solid #6f8da5}
body #advanced-view>.advanced-results>.panel-head{background:#eaf0f6;padding:17px 20px;border-bottom:1px solid #cedae4;margin-bottom:14px}
body #advanced-view>.advanced-results>.panel-head h2{color:#49657d}
body #advanced-view>.advanced-recipients{border:1px solid #bbc9ad;border-top:4px solid #809568;margin-top:0}
body #advanced-view>.advanced-recipients>.panel-head{background:#edf2e7;padding:17px 20px;border-bottom:1px solid #d1dcc5}
body #advanced-view>.advanced-recipients>.panel-head h2{color:#5a7045}
body #advanced-view>.advanced-recipients textarea{background:#fcfdf9;border-color:#c7d3ba}

/* Header without the redundant shared patient search. */
body aside{grid-template-columns:110px max-content minmax(0,1fr) max-content}
body aside>#new-patient{grid-column:2;grid-row:1;justify-self:start}
body aside nav.top-utility-nav{grid-column:4;grid-row:1}
@media(max-width:650px){body aside{grid-template-columns:100px minmax(0,1fr)}body aside>#new-patient{grid-column:2;grid-row:1}body aside nav.top-utility-nav{grid-column:1/-1;grid-row:2}body aside nav.top-primary-nav{grid-row:3}}
