/* Diary template dialog. Scoped to avoid inherited form and dialog layouts. */
#templatePanel{box-sizing:border-box;width:min(720px,calc(100vw - 32px));max-width:720px;max-height:calc(100dvh - 32px);margin:auto;padding:0;border:1px solid #dce4e7;border-radius:12px;background:#fff;color:#142c3a;font-family:var(--bs-font-family);box-shadow:0 20px 70px #142c3a26;overflow:hidden}
#templatePanel[open]{display:flex;flex-direction:column}
#templatePanel.hidden{display:none}
#templatePanel::backdrop{background:#142c3a55}
#templatePanel *{box-sizing:border-box;font-family:var(--bs-font-family)}
#templatePanel .template-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:28px 28px 16px;background:#fff;flex-shrink:0}
#templatePanel h2{margin:0 0 10px;font-size:26px;line-height:1.25;font-weight:700;color:#142c3a}
#templatePanel p{margin:0;font-size:16px;line-height:1.5;color:#637787}
#templatePanel button{display:inline-flex;align-items:center;justify-content:center;gap:8px;width:auto;min-width:44px;min-height:44px;margin:0;padding:10px 16px;border:1px solid #cedae0;border-radius:8px;background:white;color:#344d5d;font-size:16px;font-weight:600;line-height:1.3;box-shadow:none;cursor:pointer}
#templatePanel button:focus-visible,#templatePanel input:focus-visible{outline:3px solid #327a9c;outline-offset:2px}
#templatePanel button:hover{background:#f3f6f8}
#templatePanel button:disabled{opacity:.5;cursor:default}
#templatePanel #closeTemplate{flex:0 0 44px;width:44px;border:0;padding:0;font-size:28px;color:#637787}
#templatePanel .template-body{min-height:0;overflow-y:auto;padding:8px 28px 24px;overscroll-behavior:contain}
#templatePanel h3{font-size:18px;margin:0 0 14px;font-weight:600}
#templatePanel .template-keyboard-help{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%)}
#templatePanel .template-rows{display:grid;gap:10px}
#templatePanel .template-row{display:grid;grid-template-columns:44px 32px minmax(0,1fr) 44px;align-items:center;gap:10px;padding:7px;border:1px solid #d3dfe5;border-radius:8px;background:#fff}
#templatePanel .template-number{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:#edf1f4;font-size:16px;font-weight:600;color:#425867}
#templatePanel .template-row input{width:100%;min-width:0;min-height:44px;margin:0;padding:8px;border:1px solid transparent;border-radius:6px;background:transparent;color:#142c3a;font-size:16px;line-height:1.5;box-shadow:none}
#templatePanel .template-row input:hover{border-color:#d3dfe5}
#templatePanel .template-row button{width:44px;height:44px;min-height:44px;padding:10px}
#templatePanel .template-row svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
#templatePanel .template-row .template-drag{border-color:transparent;cursor:grab;touch-action:none;color:#6b8190}
#templatePanel .template-drag svg{stroke-width:4}
#templatePanel .template-remove:hover{color:#b52e28;background:#fff3f2}
#templatePanel .template-row.is-dragging{opacity:.55}
#templatePanel .template-row.is-drop-target{border-color:#327a9c;box-shadow:0 0 0 2px #327a9c33}
#templatePanel .template-row.template-drag-preview{position:fixed;z-index:10;margin:0;pointer-events:none;background:#fff;border-color:#327a9c;box-shadow:0 14px 30px #142c3a30;transform:rotate(1deg);opacity:.97}
#templatePanel #addSection{width:100%;margin-top:18px;min-height:52px;border:1px dashed #bfced8}
#templatePanel #templateFeedback:not(:empty){margin-top:12px;color:#344d5d}
#templatePanel .template-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;margin:0;padding:20px 28px;border-top:1px solid #dce4e7;background:#fff;flex-shrink:0}
#templatePanel .template-actions>div{display:flex;gap:12px}
#templatePanel #saveTemplate{background:var(--red,#e74338);border-color:var(--red,#e74338);color:#fff;padding:12px 22px}
@media(max-width:560px){
 #templatePanel{width:calc(100vw - 16px);max-height:calc(100dvh - 16px);border-radius:10px}
 #templatePanel .template-header{padding:20px 16px 12px;gap:8px}
 #templatePanel h2{font-size:22px}
 #templatePanel .template-body{padding:8px 12px 16px}
 #templatePanel .template-row{grid-template-columns:32px 24px minmax(0,1fr) 40px;gap:4px;padding:5px}
 #templatePanel .template-number{width:24px;height:28px;font-size:14px}
 #templatePanel .template-row .template-drag{width:32px;min-width:32px;padding:5px}
 #templatePanel .template-row .template-remove{width:40px;min-width:40px;padding:9px}
 #templatePanel .template-row input{padding:6px 3px}
 #templatePanel .template-actions{padding:14px 12px;gap:10px}
 #templatePanel .template-actions>div{gap:8px}
 #templatePanel .template-actions button{padding:10px;font-size:14px}
 #templatePanel #saveTemplate{padding:12px}
}


/* Bemanningsmal: faste bedriftsnavn uten å gjøre dagbokmalen tyngre. */
#templatePanel .template-staffing-settings{margin-top:24px;padding-top:22px;border-top:1px solid #dce4e7}
#templatePanel .template-staffing-settings>h3{margin-bottom:6px}
#templatePanel .template-staffing-settings>p{margin:0 0 14px;color:#5f7480;font-size:15px;line-height:1.45}
#templatePanel .template-staff-rows{display:grid;gap:10px}
#templatePanel .template-staff-row{margin:0}
#templatePanel .template-staff-empty{margin:0;padding:12px 0;color:#667b86;font-size:15px}
#templatePanel #addTemplateStaff{width:100%;margin-top:18px;min-height:52px;border:1px dashed #bfced8;background:#fff}
#templatePanel #addTemplateStaff:hover{background:#f3f6f8}
@media(max-width:560px){
  #templatePanel .template-staffing-settings{margin-top:20px;padding-top:18px}
  #templatePanel .template-staffing-settings>p{font-size:15px}
}
