/* Shared dialog shell: one scroll area, persistent actions, accessible form controls. */
#modal{--modal-ink:#173957;--modal-muted:#526c83;--modal-line:#ccdae8;width:min(760px,calc(100vw - 32px));max-width:none;max-height:calc(100vh - 32px);max-height:calc(100dvh - 32px);padding:0;border:1px solid #d2e0ed;border-radius:18px;color:var(--modal-ink);box-shadow:0 28px 90px #09244055,0 0 0 1px #ffffff60;overflow:hidden}
#modal.wide-dialog{width:min(1250px,calc(100vw - 32px))}
#modal[open]{display:flex;flex-direction:column;animation:modal-enter .2s ease-out}
#modal::backdrop{background:#0c274b99;backdrop-filter:blur(5px)}
#modal>.dialog-head{flex:0 0 auto;position:relative;gap:20px;padding:22px 28px;background:radial-gradient(ellipse at top right,#338dd755,transparent 65%),linear-gradient(115deg,#123b63,#185d96);border-bottom:3px solid #6bbbf1;box-shadow:0 3px 12px #123b6315}
#modal>.dialog-head h2{font-size:22px;font-weight:750;line-height:1.35;letter-spacing:-.35px;overflow-wrap:anywhere}
#modal>.dialog-head>.icon-btn{width:42px;height:42px;min-width:42px;border-radius:11px;font-size:26px}
#modal>.dialog-body{flex:1 1 auto;min-height:0;padding:24px 28px;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;scroll-padding:20px;background:linear-gradient(145deg,#f1f6fc,#f8fafc 65%)}
#modal>.dialog-footer{flex:0 0 auto;position:relative;display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:10px;padding:16px 28px;border-top:1px solid #d5e1ee;background:#fff;box-shadow:0 -5px 18px #17395707}
#modal .dialog-footer-note{margin-right:auto;font-size:12px;color:var(--modal-muted)}
#modal .dialog-footer>div{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
#modal .dialog-footer>span:not(.required){font-size:12px;color:var(--modal-muted);line-height:1.5}
#modal .dialog-body form{min-width:0}
#modal .form-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:0 20px}
#modal .dialog-body>form>.form-grid,#modal .dialog-body>form>fieldset>.form-grid{padding:21px 22px 3px;border:1px solid #d9e4ef;border-radius:12px;background:#fff;box-shadow:0 3px 12px #17395705;margin-bottom:20px}
#modal .field{min-width:0;gap:8px;font-size:13px;font-weight:700;line-height:1.5;color:#284a67;margin-bottom:20px}
#modal .field>span:first-child{color:#284a67;font-weight:700}
#modal .field input:not([type=checkbox]):not([type=radio]),#modal .field select,#modal .field textarea{width:100%;min-height:44px;border:1px solid #bacdde;border-radius:8px;padding:11px 13px;background:#fcfdff;color:#143654;font-size:14px;font-weight:500;line-height:1.5;box-shadow:inset 0 1px 2px #17395704;transition:border-color .15s,box-shadow .15s,background .15s}
#modal .field textarea{min-height:108px;resize:vertical}
#modal .field input::placeholder,#modal .field textarea::placeholder{color:#667d90;opacity:1;font-weight:400}
#modal .field :is(input,select,textarea):not(:disabled):hover{border-color:#769abb}
#modal .field :is(input,select,textarea):focus{outline:2px solid #287eb9;outline-offset:1px;border-color:#287eb9;background:#fff;box-shadow:0 0 0 5px #398bca1a}
#modal .field :is(input,select,textarea):disabled{opacity:1;color:#52677a;-webkit-text-fill-color:#52677a;background:#edf2f7;border-color:#d1dce6;cursor:default}
#modal .field :is(input,select,textarea)[readonly]{background:#eef5fb}
#modal .field :is(input,select,textarea):user-invalid{border-color:#c24747;background:#fff9f9}
#modal .field .field-hint,#modal .field>small{font-size:12px;font-weight:400;line-height:1.55;color:var(--modal-muted)}
#modal .required{color:#b92e43;font-weight:800}
#modal .field input[type=checkbox],#modal .field input[type=radio]{accent-color:#176eb0;width:18px;height:18px;min-height:0;flex:none}
#modal .field input[type=file]{border-style:dashed;background:#f1f7fd;font-size:13px;padding:10px}
#modal input[type=file]::file-selector-button{border:1px solid #bad1e4;border-radius:6px;padding:8px 11px;margin-right:12px;background:#e3effa;color:#214d70;font-weight:700;cursor:pointer}
#modal .notice{border:1px solid #c9dff0;border-left:4px solid #3881b5;border-radius:9px;background:#eaf4fc;color:#315675;font-size:13px;line-height:1.65;padding:14px 17px}
#modal .notice strong{color:#173957}
#modal .notice p:last-child{margin-bottom:0}
#modal .error{border:1px solid #ebbdc3;border-left:4px solid #c04756;background:#fff0f2;color:#8c2635;padding:14px 17px;font-size:13px;line-height:1.6;border-radius:9px}
#modal :is(#form-error,#calendar-form-error,#register-error):empty{display:none}
#modal .dialog-body h3{font-size:16px;line-height:1.4;color:#173957;font-weight:750}
#modal .dialog-body>.small,#modal .dialog-body .muted{color:var(--modal-muted);line-height:1.65}
#modal .btn{min-height:42px;padding:10px 16px;border:1px solid #c6d7e6;border-radius:8px;font-size:13px;font-weight:700;white-space:normal;line-height:1.35;transition:background .15s,box-shadow .15s,transform .15s}
#modal .btn.primary{color:#fff;background:linear-gradient(115deg,#155580,#2076b1);border-color:#175d8b;box-shadow:0 3px 8px #16578423}
#modal .btn.danger{color:#a93244;background:#fff4f5;border-color:#e6bdc4}
#modal .btn:enabled:hover{transform:translateY(-1px);box-shadow:0 5px 12px #1b497b1c}
#modal .btn.primary:enabled:hover{background:linear-gradient(115deg,#10496e,#176598)}
#modal .btn:enabled:active{transform:translateY(0)}
#modal .btn:disabled{opacity:.55;box-shadow:none}
#modal :is(button,a,summary):focus-visible{outline:3px solid #2c83c4;outline-offset:3px}
#modal .dialog-head .icon-btn:focus-visible{outline-color:#fff}
#modal .table-scroll{border:1px solid #d5e1ec;border-radius:9px;background:#fff}
#modal .table-scroll th{color:#315370;background:#eaf2fa;white-space:normal;line-height:1.5}
#modal .table-scroll td{border-bottom:1px solid #e1e9f1;line-height:1.5}
#modal .table-scroll tr:last-child td{border-bottom:0}
#modal .cge-form-metrics{padding:20px;border:1px solid #d8e3ee;border-radius:12px;background:#fff;margin-bottom:20px}
#modal .cge-metric-row{border:1px solid #d7e3ed;border-radius:9px;background:#f7faff;padding:16px;margin-top:12px}
#modal .student-form-section,#modal .enr-form-section,#modal .cgc-form-section{box-shadow:0 3px 12px #17395705}
#modal details.competency-details{background:#fff;border-color:#cedce9;padding:15px;border-radius:9px}
#modal details.competency-details>summary{color:#285472;font-weight:700;line-height:1.6}

/* Agenda activity form: distinct context, activity, schedule and evidence sections. */
#modal.agenda-form-dialog{width:min(1120px,calc(100vw - 32px))}
.agenda-form-heading{display:flex;align-items:center;gap:14px}
.agenda-form-heading>span{width:48px;height:48px;display:grid;place-items:center;flex:none;border:1px solid #ffffff40;border-radius:12px;background:#ffffff12;color:#e5f4ff}
.agenda-form-heading small{display:block;color:#cae8ff;text-transform:uppercase;letter-spacing:1px;font-size:10px;font-weight:700;margin-bottom:5px}
.agenda-form-intro{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:19px;font-size:12px;color:#526c83}
.agenda-form-intro>span{display:inline-flex;align-items:center;gap:8px}
.agenda-form-layout{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(280px,1fr);align-items:start;gap:18px}
.modal-form-section{min-width:0;border:1px solid #d2e0ed;border-radius:12px;background:#fff;box-shadow:0 3px 12px #17395705;padding:20px 21px 0}
.modal-section-head{display:flex;align-items:flex-start;gap:11px;padding-bottom:15px;margin-bottom:18px;border-bottom:1px solid #e5edf5}
.modal-section-head>span{display:grid;place-items:center;width:32px;height:32px;flex:none;border-radius:9px;background:#eaf3fb;color:#25618d;border:1px solid #d4e4f2;font-size:12px;font-weight:800}
#modal .modal-section-head h3{margin:0 0 5px;font-size:16px}
.modal-section-head p{margin:0;color:#526c83;font-size:12px;line-height:1.5}
.agenda-form-context{grid-column:1/-1}
#modal .agenda-form-context .form-grid{grid-template-columns:2fr 1.4fr .65fr 1fr;gap:0 16px}
.agenda-form-activity .field:has([name=p_title]) input{font-weight:650;background:#f7fbff}
#modal .agenda-form-activity [name=p_description]{min-height:124px;background:#f4f8fc;font-size:13px}
.agenda-form-evidence{grid-column:1/-1}
.agenda-form-files{margin-top:18px}
.agenda-form-evidence>summary{display:flex;align-items:center;gap:10px;cursor:pointer;font-weight:700;color:#245476;font-size:14px;list-style:none;margin:-20px -21px 0;padding:20px 21px}
.agenda-form-evidence>summary::after{content:'+';margin-left:auto;font-size:22px;color:#4b7c9f}
.agenda-form-evidence[open]>summary::after{content:'−'}
.agenda-form-evidence[open]>summary{border-bottom:1px solid #e5edf5;margin-bottom:18px}
.agenda-form-evidence>summary::-webkit-details-marker{display:none}
.agenda-form-evidence #upload-form{padding:16px;border:1px dashed #bacfe1;border-radius:9px;background:#f6faff;margin-bottom:20px}
.agenda-form-evidence .field{margin-bottom:16px}
.agenda-form-note{display:flex;align-items:flex-start;gap:8px;padding:12px 14px;border-radius:8px;background:#eff7fc;color:#446783;font-size:12px;line-height:1.6;margin-bottom:20px}
.agenda-form-note svg{flex:none;margin-top:2px}
#modal .agenda-form-evidence a{overflow-wrap:anywhere}
@keyframes modal-enter{from{opacity:0;transform:translateY(9px) scale(.99)}to{opacity:1;transform:translateY(0) scale(1)}}
.assignment-section-picker{border:1px solid #d2e0ed;border-radius:12px;background:#fff;padding:20px;margin:18px 0}
.assignment-section-picker>header{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:16px}
.assignment-section-picker h3{margin-bottom:5px}.assignment-section-picker header p{font-size:12px;color:#526c83;margin:0}
#assignment-selection-count{border:1px solid #bed8ed;border-radius:8px;background:#edf6fe;padding:8px 11px;color:#285c85;font-size:12px;font-weight:700;white-space:nowrap}
.assignment-selection-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding-bottom:15px;border-bottom:1px solid #e4edf5;margin-bottom:16px}
#modal .assignment-selection-tools .field{flex:1;min-width:180px;margin:0}
#assignment-sections{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;max-height:320px;overflow:auto}
.assignment-section-option{display:flex;align-items:center;gap:10px;padding:12px;border:1px solid #c9daea;border-radius:9px;cursor:pointer;background:#fafcff;min-width:0}
.assignment-section-option:has(input:checked){background:#eaf4ff;border-color:#347cbb;box-shadow:inset 3px 0 #347cbb}
.assignment-section-option input{width:18px;height:18px;flex:none;accent-color:#176eb0}
.assignment-section-option strong,.assignment-section-option small{display:block;line-height:1.5;overflow-wrap:anywhere}.assignment-section-option strong{font-size:13px}.assignment-section-option small{font-size:11px;color:#526c83;margin-top:4px}
.assignment-section-option.occupied{background:#f1f3f6;cursor:default;color:#637183}.assignment-empty{grid-column:1/-1;font-size:13px;padding:16px;color:#526c83}
.assignment-preview{padding:15px 17px;border:1px solid #bbd9d3;border-radius:9px;background:#edf8f5;color:#225e51;font-weight:700;font-size:13px;line-height:1.6}
#assignment-areas ul{display:flex;flex-wrap:wrap;gap:8px;list-style:none;padding:0;margin:12px 0 0}#assignment-areas li{border:1px solid #cadfeb;border-radius:6px;padding:6px 10px;background:#fff;font-size:12px}
@media(max-width:700px){#assignment-sections{grid-template-columns:repeat(2,minmax(0,1fr))}.assignment-section-picker{padding:15px}.assignment-section-picker>header{align-items:flex-start;flex-direction:column}.assignment-selection-tools .btn{flex:1}}
@media(max-width:420px){#assignment-sections{grid-template-columns:1fr}}
@media(max-width:900px){.agenda-form-layout{grid-template-columns:1fr}.agenda-form-context,.agenda-form-evidence{grid-column:auto}#modal .agenda-form-context .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){
 #modal,#modal.wide-dialog,#modal.agenda-form-dialog{width:calc(100vw - 16px);max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);border-radius:13px}
 #modal>.dialog-head{padding:17px 16px;gap:12px}#modal>.dialog-head h2{font-size:19px}#modal>.dialog-head>.icon-btn{width:38px;height:38px;min-width:38px}
 #modal>.dialog-body{padding:16px 13px;scrollbar-gutter:auto}#modal>.dialog-footer{padding:12px 14px;gap:8px}
 #modal .dialog-footer-note{display:none}#modal .dialog-footer>.btn{flex:1}#modal .dialog-footer>div{flex:1;justify-content:flex-end}
 #modal .form-grid,#modal .agenda-form-context .form-grid{grid-template-columns:1fr;gap:0}
 #modal .dialog-body>form>.form-grid,#modal .dialog-body>form>fieldset>.form-grid{padding:17px 15px 0}
 #modal .field input:not([type=checkbox]):not([type=radio]),#modal .field select,#modal .field textarea{font-size:16px}
 #modal .field{font-size:13px;margin-bottom:18px}#modal .btn{font-size:12px;padding:10px 13px}
 .modal-form-section{padding:18px 16px 0}.modal-section-head{gap:9px}.agenda-form-heading>span{display:none}.agenda-form-heading small{font-size:9px}
 .agenda-form-intro{align-items:flex-start;flex-direction:column;gap:8px;font-size:11px}.agenda-form-evidence>summary{margin:-18px -16px 0;padding:18px 16px}
}
@media(prefers-reduced-motion:reduce){#modal[open]{animation:none}#modal .btn,#modal .field :is(input,select,textarea){transition:none}#modal .btn:enabled:hover{transform:none}}
@media print{#modal[open]{display:block;position:absolute;max-height:none;height:auto;overflow:visible;width:100%;box-shadow:none;border:0}#modal>.dialog-body{overflow:visible;padding:0;background:#fff}#modal>.dialog-head,#modal>.dialog-footer{display:none}#modal .table-scroll{overflow:visible}}
