/* Shared private template catalog; the rest of Preferences keeps its existing controls. */
.doctor-templates{margin-bottom:38px;min-width:0}
.templates-heading{display:flex;justify-content:space-between;align-items:center;gap:16px;padding-bottom:16px;border-bottom:1px solid var(--line)}
.templates-heading h2{font-size:19px;font-weight:500;line-height:1.5}
#template-count{font-size:12px;font-weight:400;color:var(--muted);margin-left:8px;white-space:nowrap}
.templates-filters{display:flex;align-items:center;gap:24px;padding:18px 0}
.templates-search{display:flex;align-items:center;gap:8px;border-bottom:1px solid var(--control);width:min(340px,100%);color:var(--muted)}
.templates-search .icon{width:17px;height:17px;flex:none}
.templates-search input{border:0;background:transparent;border-radius:0;width:100%;padding:10px 0;min-height:44px;font-size:13px;box-shadow:none}
.templates-category{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:12px}
.templates-category select{border:0;background:transparent;width:auto;min-height:44px;padding-left:0;color:var(--ink);font-size:13px}
.templates-table{width:100%;border-collapse:collapse;table-layout:fixed;font-size:13px}
.templates-table th{text-align:left;font-weight:400;color:var(--muted);border-bottom:1px solid var(--line);padding:12px 16px 12px 0}
.templates-table td{border-bottom:1px solid var(--line);padding:12px 16px 12px 0;vertical-align:middle;overflow-wrap:anywhere}
.templates-table th:first-child{width:25%}.templates-table th:nth-child(2){width:18%}.templates-table th:last-child{width:180px;padding-right:0;text-align:right}
.templates-table td:last-child{padding-right:0}.templates-table td:nth-child(3){color:var(--muted)}.templates-table strong{font-weight:500}
.templates-title,.templates-preview{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}.templates-preview:focus-visible{outline:2px solid var(--action);outline-offset:3px}
.templates-row-actions{display:flex;justify-content:flex-end}.templates-row-actions .template-remove{color:var(--danger)}
.templates-state{padding:26px 0;font-size:13px}.templates-state h3{font-size:15px;font-weight:500}.templates-state p{margin-top:8px;color:var(--muted)}.templates-state .form-error{color:var(--danger)}
.preferences-personal{max-width:760px}.preferences-personal .panel{margin-bottom:0}
.template-dialog{box-sizing:border-box;background:var(--paper);color:var(--ink);border:0;border-radius:14px;box-shadow:0 16px 50px rgb(0 0 0 / .24);padding:24px;width:min(620px,calc(100vw - 32px));max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;overscroll-behavior:contain;scrollbar-color:var(--control) var(--paper)}
.template-dialog::backdrop{background:var(--overlay,rgb(10 24 34 / .45))}
.template-dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.template-dialog-heading h2{font-size:19px;font-weight:500}.template-dialog-heading>.ui-line-action{margin-right:-10px;flex:none}
.template-dialog .field{margin:18px 0 0}.template-dialog .field input,.template-dialog .field select,.template-dialog .field textarea{width:100%}.template-dialog .field textarea{min-height:150px;resize:vertical}
.template-form-row{display:grid;grid-template-columns:minmax(150px,.8fr) minmax(0,1.2fr);gap:16px}
.doctor-template-variables{margin-top:14px;font-size:12px;color:var(--muted)}.doctor-template-variables>div{display:flex;flex-wrap:wrap;gap:0 16px;margin:4px 0}.doctor-template-variables .ui-text-action{font-size:12px;text-decoration:underline;text-underline-offset:3px;min-height:44px;overflow-wrap:anywhere;text-align:left}
.template-dialog .form-error{margin-top:12px}.template-dialog .form-error:empty{margin:0}
.template-dialog-footer{display:flex;justify-content:flex-end;align-items:center;gap:24px;margin-top:24px}
.template-dialog .template-delete-button{background:var(--danger);color:var(--on-danger);border-color:var(--danger)}
.template-delete-dialog{width:min(480px,calc(100vw - 32px))}.template-delete-dialog>form>p:not(.form-error){margin-top:14px;overflow-wrap:anywhere}#template-delete-description{font-size:15px;font-weight:500}
.template-dialog :is(input,textarea,select,button):focus-visible,.templates-filters :is(input,select):focus-visible{outline:2px solid var(--action);outline-offset:3px}
@media(hover:hover) and (pointer:fine){.templates-table tbody tr:hover{background:var(--hover-row,var(--quiet))}}
@media(max-width:620px){.templates-heading{align-items:flex-start;flex-direction:column;gap:12px}.templates-heading h2{font-size:18px}.templates-filters{display:block;padding:14px 0}.templates-search{width:100%}.templates-category{justify-content:space-between;margin-top:8px}.templates-category select{max-width:calc(100% - 85px)}.templates-table,.templates-table tbody{display:block}.templates-table thead{position:absolute;clip-path:inset(50%);width:1px;height:1px;overflow:hidden}.templates-table tr{display:grid;grid-template-columns:minmax(0,1fr) 88px;border-bottom:1px solid var(--line);padding:14px 0}.templates-table td{display:block;border:0;padding:0}.templates-table td:first-child{grid-column:1;grid-row:1}.templates-table td:nth-child(2){grid-column:1;grid-row:2;color:var(--muted);font-size:12px;margin:3px 0 8px}.templates-table td:nth-child(3){grid-column:1;grid-row:3;font-size:12px;padding-right:8px}.templates-table td:last-child{grid-column:2;grid-row:1/span 3}.template-dialog{padding:20px}.template-form-row{grid-template-columns:1fr;gap:0}.template-dialog .field :is(input,textarea,select){font-size:16px}.template-dialog-footer{gap:16px}.template-dialog-footer>.button{min-width:0}.doctor-template-variables .ui-text-action{font-size:11px}.doctor-templates{margin-bottom:30px}}

.phrase-order-controls{display:inline-flex;align-items:center;flex:none;gap:0}.phrase-order-controls>.ui-line-action{width:36px;min-width:36px;height:36px;min-height:36px;padding:7px}.phrase-order-controls .icon{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.phrase-order-controls button:disabled{opacity:.35;cursor:default}.templates-order-hint{margin:-4px 0 8px;color:var(--muted)}
@media(max-width:620px){.templates-row-actions{display:grid;grid-template-columns:44px 44px;justify-content:end}.templates-row-actions>.phrase-order-controls{grid-column:1/-1}.phrase-order-controls>.ui-line-action{width:44px;min-width:44px;height:44px;min-height:44px}.templates-table td:first-child{padding-right:8px}}

.template-content-fields{min-width:0;margin:0;padding:0;border:0}
.template-medication-fields:not([hidden]){display:grid;gap:12px}
.template-medication-fields label{display:grid;gap:4px}
