/* Appointment entry: compact desktop rows, independently scrolling histories. */
.ae-dialog{width:min(1240px,98vw);max-width:98vw;max-height:96dvh;padding:0;border:1px solid #8795a7;border-radius:5px;color:#223447;background:#f0f2f5;box-shadow:0 20px 70px #182c4c55;font:13px/1.35 system-ui,sans-serif}
.ae-dialog::backdrop{background:#152a4666}.ae-dialog *{box-sizing:border-box}.ae-form{display:flex;flex-direction:column;max-height:96dvh;margin:0}
.ae-heading{display:flex;align-items:center;gap:12px;padding:10px 13px;border-bottom:1px solid #b8c4d0;background:linear-gradient(#fff,#edf1f6)}.ae-heading>div{flex:1}.ae-heading span{font-size:10px;color:#576c80;letter-spacing:.06em}.ae-heading h2{font-size:19px;margin:2px 0 0;line-height:1.2}.ae-heading .ae-number{font-size:16px;letter-spacing:0}.ae-heading>button{font-size:22px!important;width:30px}
.ae-dialog button{font:inherit;color:#243f59;min-height:29px;padding:3px 9px;border:1px solid #b1becd;border-radius:3px;background:linear-gradient(#fff,#e9eef4);cursor:pointer}.ae-dialog button:hover{background:#e0edff}.ae-dialog button:disabled{cursor:default;opacity:.48}.ae-dialog button:focus-visible,.ae-dialog input:focus-visible,.ae-dialog select:focus-visible,.ae-dialog textarea:focus-visible{outline:2px solid #236cc5;outline-offset:1px}.ae-toolbar{display:flex;gap:5px;align-items:center;padding:6px 9px;border-bottom:1px solid #b9c5d1;background:#e8edf3;flex-shrink:0}.ae-toolbar>span{flex:1}.ae-dialog .ae-primary{background:#165da0;color:white;border-color:#165da0;font-weight:650}.ae-dialog kbd{font:10px system-ui;opacity:.7;margin-left:5px}
.ae-body{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(340px,1fr);overflow:auto;min-height:0;align-items:start}.ae-main{min-width:0;border-right:1px solid #b7c3d0;padding:7px}.ae-patient,.ae-scheduling{padding:2px 2px 7px;border-bottom:1px solid #bec9d4;margin-bottom:7px}.ae-field{display:flex;gap:7px;align-items:center;margin:0;min-width:0;font-weight:400}.ae-field>span{width:115px;flex-shrink:0;text-align:right;font-size:12px}.ae-dialog input:not([type=checkbox]):not([type=radio]),.ae-dialog select,.ae-dialog textarea{font:13px system-ui;color:#172d43;padding:3px 6px;border:1px solid #adbccc;border-radius:2px;background:white;min-width:0;width:100%;height:28px;margin:0}.ae-dialog textarea{height:57px;resize:vertical}.ae-dialog input[readonly]{background:#eaf0f5;color:#4e6075}.ae-dialog input[type=checkbox],.ae-dialog input[type=radio]{width:15px;height:15px;accent-color:#236dad;margin:0;flex-shrink:0}.ae-row{display:flex;gap:8px;align-items:center;margin-bottom:5px}.ae-row>.ae-field{flex:1}.ae-demographics .ae-field>span{width:auto}.ae-demographics{padding-left:83px}.ae-demographics input[name=patientCpf]{max-width:150px}.ae-demographics input[type=date]{min-width:118px}.ae-demographics output{white-space:nowrap;font-size:11px;color:#637187}.ae-check{display:flex;align-items:center;gap:6px;white-space:nowrap;font-size:12px}.ae-name-row{display:flex;gap:5px;margin-bottom:5px}.ae-name-row>.ae-field{flex:1}.ae-name-row input{font-weight:700!important}.ae-contacts .ae-field:first-child{flex:1.4}.ae-contacts .ae-field:nth-child(2)>span{width:auto}.ae-update{margin:5px 0 0 122px;color:#586e84;font-size:11px}.ae-results{max-height:150px;overflow:auto;background:#fff;border:1px solid #9fb1c7;margin:0 0 6px 122px}.ae-results>button{width:100%;display:flex;flex-direction:column;text-align:left;border:0;border-bottom:1px solid #dbe3eb;border-radius:0}.ae-results span,.ae-results p{font-size:11px;margin:4px}.ae-date-row .ae-field>span{width:auto}.ae-date-row .ae-field:first-child{flex:1.25}.ae-date-row .ae-field:nth-child(2){flex:.7}.ae-date-row .ae-field:nth-child(3){flex:1}.ae-date-row .ae-field:nth-child(4){flex:.9}.ae-date-row{flex-wrap:wrap}.ae-doctor-row .ae-field:first-child{flex:1.5}.ae-doctor-row .ae-field:last-child>span{width:64px}.ae-fit{padding:3px 0 0 7px;flex-wrap:wrap}.ae-fit>input{flex:1;min-width:170px!important}.ae-fit:has([name=overbook]:not(:checked))>input{display:none}.ae-information h3{font-size:13px;margin:0 -1px 7px;padding:5px 8px;border:1px solid #b5c2d0;background:#e0e7ef}.ae-information h3 span{font-weight:400;color:#60738a;font-size:11px;margin-left:16px}.ae-payer>.ae-field:first-child{flex:1.5}.ae-payer>.ae-field:last-child>span{width:35px}.ae-type-list{margin:5px 0 5px 122px;max-height:142px;overflow:auto;border:1px solid #b7c4d1;background:white}.ae-dialog table{width:100%;border-collapse:collapse;table-layout:fixed;font-size:12px}.ae-dialog th{position:sticky;top:0;background:#eef2d9;color:#334d61;font-weight:600;padding:4px;text-align:left;z-index:1}.ae-dialog td{border-bottom:1px solid #d8e1e6;padding:3px 5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ae-dialog tbody tr:nth-child(odd){background:#e7f4e9}.ae-dialog tbody tr:nth-child(even){background:#fffef0}.ae-type-list th:first-child{width:40px}.ae-type-list th:nth-child(2){width:75px}.ae-type-list th:last-child{width:40px}.ae-type-list td:nth-child(3){white-space:normal}.ae-notes{align-items:flex-start;margin:5px 0}.ae-notes>span{padding-top:7px}.ae-state>.ae-field:first-child{flex:1.5}.ae-state>.ae-field:last-child>span{width:88px}.ae-confirm-grid{display:grid;grid-template-columns:1.15fr 1fr;gap:7px;margin-left:122px}.ae-confirm-grid fieldset{border:1px solid #c5cfd9;padding:5px 8px;margin:0;font-size:11px;min-width:0}.ae-confirm-grid fieldset label{display:inline-flex;gap:3px;align-items:center;margin:1px 7px 3px 0}.ae-confirm-grid small{display:block;color:#6b7784}.ae-confirm{border:1px solid #c5cfd9;padding:6px 8px}.ae-confirm p{margin:4px 0 0;color:#4b6a7b;font-size:11px}.ae-audit{font-size:10px;color:#516c80;padding:7px 5px 1px;line-height:1.6}.ae-sidebar{padding:7px;min-width:0;display:flex;flex-direction:column;gap:7px}.ae-sidebar section{border:1px solid #bfccd6;background:#f8fafc}.ae-sidebar h3{font-size:12px;background:#dfe7ed;padding:5px 7px;margin:0;font-weight:600}.ae-sidebar h3 small{color:#14747a;font-weight:400}.ae-history{max-height:137px;overflow:auto}.ae-visits{max-height:210px}.ae-history td[colspan="5"]{padding:0}.ae-history-row{display:grid;grid-template-columns:1fr .6fr .8fr 1fr 1fr;width:100%;border:0!important;background:transparent!important;padding:4px!important;text-align:left;font-size:11px!important;gap:4px;border-radius:0!important}.ae-history-row span{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ae-history-row.ae-current{color:#1a63b8;font-weight:650}.ae-history-row[aria-pressed=true]{background:#c4ddfa!important;outline:1px solid #538ed0;outline-offset:-1px}.ae-empty{text-align:center;color:#738397}.ae-limits{max-height:94px;overflow:auto;padding:3px 7px;font-size:11px}.ae-limits p{margin:3px 0}.ae-hint{font-size:10px;color:#687d90;margin:0}.ae-feedback{padding:6px 12px;min-height:29px;background:#e4eef7;border-top:1px solid #bbcbd8;font-size:12px;flex-shrink:0}.ae-feedback.error{background:#fff0db;color:#873c0c}.ae-free,.ae-notice{padding:6px;background:#e6f1fc;border:1px solid #b6cfdf;margin-top:6px;font-size:12px}.ae-free strong{display:block;margin-bottom:5px}.ae-free button{margin:2px;min-width:56px}.ae-free{max-height:130px;overflow:auto}
@media(max-width:1100px){.ae-dialog{font-size:12px}.ae-body{grid-template-columns:minmax(0,1.7fr) minmax(300px,1fr)}.ae-field>span{width:94px;font-size:11px}.ae-update,.ae-confirm-grid,.ae-type-list,.ae-results{margin-left:101px}.ae-demographics{padding-left:0}.ae-heading h2{font-size:17px}.ae-toolbar button{font-size:11px;padding:3px 6px}.ae-row{gap:5px}.ae-date-row .ae-field>span{font-size:10px}}
@media(max-height:800px) and (min-width:850px){.ae-heading{padding:6px 12px}.ae-toolbar{padding:4px 7px}.ae-type-list{max-height:116px}.ae-history{max-height:105px}.ae-visits{max-height:182px}.ae-dialog textarea{height:45px}.ae-confirm p{margin:2px 0}.ae-patient,.ae-scheduling{margin-bottom:5px;padding-bottom:5px}.ae-dialog .ae-audit{padding-top:3px}}
@media(max-width:849px){.ae-body{grid-template-columns:1fr}.ae-main{border-right:0}.ae-sidebar{display:grid;grid-template-columns:1fr 1fr}.ae-toolbar{flex-wrap:wrap}.ae-toolbar>span{display:none}.ae-heading h2{font-size:15px}.ae-demographics{flex-wrap:wrap}.ae-date-row>.ae-field{flex:1 1 40%!important}.ae-confirm-grid{margin-left:0}.ae-dialog{width:98vw}.ae-contacts{flex-wrap:wrap}.ae-sidebar>button,.ae-sidebar>.ae-hint{grid-column:1/-1}}

.ae-type-lookup{position:relative;margin-bottom:5px}.ae-type-lookup .ae-type-list{position:absolute;top:100%;left:122px;right:0;margin:3px 0 0;z-index:20;max-height:230px;border-radius:6px;box-shadow:0 5px 16px #233d5b40;background:white}.ae-type-list[hidden]{display:none}@media(max-width:1100px){.ae-type-lookup .ae-type-list{left:101px}}

.ae-dialog [name=patientName],.ae-dialog [data-patient-results] button strong{ text-transform:uppercase }

/* Compact procedure abbreviation suggestions only. */
.ae-dialog .ae-type-list thead{display:none}
.ae-dialog .ae-type-list table{height:auto;min-height:0;font:12px Arial;table-layout:fixed}
.ae-dialog .ae-type-list tbody,.ae-dialog .ae-type-list tr{height:auto;min-height:0}
.ae-dialog .ae-type-list td{height:auto;min-height:0;padding:3px 5px;line-height:16px;font:12px/16px Arial;vertical-align:middle}
.ae-dialog .ae-type-list td:first-child{width:32px}
.ae-dialog .ae-type-list td:nth-child(2){width:65px}
.ae-dialog .ae-type-list td:last-child{width:38px}
.ae-dialog .ae-type-list input[type=checkbox]{width:14px;height:14px;margin:0;vertical-align:middle}
.ae-dialog .ae-type-list tr[data-type-row]{cursor:pointer}
.ae-dialog .ae-type-list tr[data-type-row]:hover{filter:brightness(.97)}
.ae-dialog .ae-type-list tr[data-type-row]:focus-visible{outline:2px solid #236cc5;outline-offset:-2px}

.ae-dialog [data-type-search],.ae-dialog .ae-type-list td:nth-child(2){text-transform:uppercase}

/* Compact appointment history tables; override inherited table minimums. */
.ae-dialog .ae-history table{height:auto;min-height:0;font:12px Arial}
.ae-dialog .ae-history thead,.ae-dialog .ae-history tbody,.ae-dialog .ae-history tr{height:auto;min-height:0}
.ae-dialog .ae-history th,.ae-dialog .ae-history td{height:auto;min-height:0;padding:3px 5px;font:12px/16px Arial;vertical-align:middle}
.ae-dialog .ae-history td[colspan="5"]{padding:0}
.ae-dialog .ae-history-row{min-height:0;height:auto;padding:4px!important;line-height:16px;font-size:12px!important}
.ae-dialog .ae-history .ae-empty{height:auto;min-height:0;padding:8px 5px}

.ae-dialog .ae-results>button.ae-patient-active{background:#cbe1f7;color:#173e63;box-shadow:inset 3px 0 #2678b8;outline:1px solid #6a9bc2;outline-offset:-1px}

/* Keep typing and suggestion lists from resizing the appointment window. */
.ae-dialog{height:min(940px,96dvh);overflow:hidden}
.ae-dialog .ae-form{height:100%;min-height:0}
.ae-dialog .ae-body{flex:1;scrollbar-gutter:stable}
.ae-dialog .ae-feedback{height:46px;overflow:auto}
.ae-patient-lookup{position:relative}
.ae-dialog .ae-patient-lookup .ae-results{position:absolute;top:100%;left:122px;right:0;margin:0;z-index:30;max-height:180px;box-shadow:0 5px 16px #233d5b40}
.ae-dialog .ae-demographics{display:grid;grid-template-columns:auto minmax(150px,185px) minmax(175px,210px) auto auto;gap:8px;padding-left:0;justify-content:start;align-items:center}
.ae-dialog .ae-demographics .ae-field{gap:6px}
.ae-dialog .ae-demographics .ae-field>span{width:auto}
.ae-dialog .ae-demographics input[name=patientCpf]{max-width:none;width:100%}
.ae-dialog .ae-demographics input[type=date]{min-width:0;width:100%}
.ae-dialog .ae-demographics .ae-no-cpf{white-space:nowrap}
@media(min-width:850px) and (max-width:1100px){
  .ae-dialog .ae-demographics{grid-template-columns:auto minmax(130px,1fr) minmax(150px,1fr);gap:6px}
  .ae-dialog .ae-demographics output{grid-column:2}
}
@media(max-width:1100px){.ae-dialog .ae-patient-lookup .ae-results{left:101px}}
@media(max-width:600px){
  .ae-dialog .ae-demographics{grid-template-columns:auto minmax(100px,1fr);gap:6px}
  .ae-dialog .ae-demographics .ae-field:has([name=patientBirthDate]){grid-column:1/-1;max-width:240px}
  .ae-dialog .ae-patient-lookup .ae-results{left:0}
}
