.crm-table-scroll{max-width:100%;overflow:auto}.crm-table-scroll table{min-width:760px;width:100%}.tariff-catalog{min-width:0}.tariff-catalog .toolbar{flex-wrap:wrap}.tariff-catalog details button{display:block;margin:8px 0}.crm-usage-dialog{width:min(880px,92vw);max-height:88vh;overflow:auto}.crm-usage-dialog article{border-bottom:1px solid #ddd;padding:12px}.crm-card{position:fixed;inset:78px 12px 12px;z-index:45;background:#f6f8f4;border:1px solid #d5ddcf;border-radius:16px;padding:20px;overflow:auto;box-sizing:border-box}.crm-card-header{display:flex;gap:16px;align-items:center;flex-wrap:wrap}.crm-card-layout{display:grid;grid-template-columns:minmax(0,2fr) minmax(270px,1fr);gap:20px}.crm-card-layout>*{min-width:0}.crm-card .panel{margin:12px 0}.crm-visit-tiles{display:flex;gap:8px;flex-wrap:wrap}.crm-visit{padding:10px;border:1px solid #becbb6;border-radius:8px;min-width:96px;background:white}.crm-visit strong,.crm-visit small{display:block}.crm-visit-present{border-left:5px solid #398547}.crm-visit-absent{border-left:5px solid #b1603a}.crm-visit-cancelled{border-left:5px solid #7a7a7a}.crm-facts{display:grid;grid-template-columns:minmax(90px,1fr) 2fr;gap:8px}.crm-facts dd{margin:0;overflow-wrap:anywhere}.crm-card .row{flex-wrap:wrap}.crm-card button:focus-visible,.tariff-catalog button:focus-visible,.crm-table-scroll:focus-visible{outline:3px solid #477943;outline-offset:3px}.crm-card-tabs{display:flex;flex-wrap:wrap;gap:8px}.crm-card section[hidden]{display:none}.crm-card-avatar{width:64px;height:64px;border-radius:50%;background:#e3eadf;display:grid;place-items:center}.crm-card-status{border-radius:6px;padding:5px;border:1px solid #ced8c7}.crm-card [role=alert]{color:#99382d}.crm-preview-list{max-height:200px;overflow:auto}.crm-card h2,.crm-card h3{overflow-wrap:anywhere}@media(max-width:1024px){.crm-card-layout{grid-template-columns:minmax(0,1fr)}.crm-card{inset:72px 6px 6px;padding:14px}}@media(max-width:768px){.crm-card-header{align-items:flex-start}.crm-facts{grid-template-columns:1fr}.tariff-catalog .toolbar label{max-width:100%}}

.crm-card .crm-card-tabs{position:static;width:auto;min-height:0;height:auto;background:transparent;border:0;padding:8px 0;display:flex;flex-direction:row;overflow:visible}.crm-card .crm-card-tabs button{width:auto;color:#194c3b;background:#e8eee4;padding:10px 14px}.crm-card .crm-card-tabs button[aria-pressed=true]{background:#15775b;color:white}.crm-card-header>div:last-child{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.crm-card-header label{display:flex;align-items:center;gap:8px}.crm-card .row button{max-width:100%}.crm-table-scroll{scrollbar-gutter:stable}.crm-card .crm-card-actions{margin:12px 0}.crm-card-actions summary{cursor:pointer;font-weight:600;padding:8px 0}

dialog.crm-card{margin:0;width:calc(100vw - 24px);height:calc(100vh - 90px);max-width:none;max-height:none}dialog.crm-card::backdrop{background:rgba(15,35,25,.15)}@media(max-width:1024px){dialog.crm-card{width:calc(100vw - 12px);height:calc(100vh - 78px)}}
/* School attendance ribbons: symbols remain readable without colour. */
.school-squares{display:flex;gap:8px;overflow-x:auto;padding:10px 2px;scroll-snap-type:x proximity}
.school-square{flex:0 0 64px;min-height:82px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px solid #cad4df;border-radius:8px;background:#f1f4f8;color:#253447;scroll-snap-align:start;touch-action:manipulation}
.school-square.state-present,.school-square.is-covered{background:#dbf4e5;border-color:#258957}
.school-square.is-unpaid{border:3px solid #d52943}
.school-square.state-absent{background:#ffe8ed;color:#ae1738}
.school-square.state-unmarked{border-style:dashed;background:#eee}
.school-square.state-excused{background:#e3ecff}.school-square.state-makeup{background:#eae1ff}
.school-square.state-cancelled{text-decoration:line-through;opacity:.6}
.school-square.state-waiting{background:#fff0b2;border-color:#b58b11}
.school-square.state-partial{background:linear-gradient(90deg,#dbf4e5 50%,#fff0b2 50%)}
.school-square:focus-visible{outline:3px solid #265fc5;outline-offset:3px}
/* Group history fits three chronological rows; narrow screens wrap readable tiles. */
.school-attendance-history{min-width:0;max-width:100%;container-type:inline-size}
.school-squares:is(.school-squares--group,.school-squares--client){display:grid;grid-template-columns:repeat(var(--lesson-columns),minmax(0,1fr));gap:calc(8px / 1.5);width:min(100%,calc(var(--lesson-columns) * 48px - 2.6667px));max-width:100%;min-width:0;padding:calc(10px / 1.5) calc(2px / 1.5);overflow:visible;scroll-snap-type:none}
.school-attendance-history :is(.school-squares--group,.school-squares--client)>.school-square{box-sizing:border-box;min-width:0;width:100%;height:calc(70px / 1.5);min-height:0;margin:0;padding:2px 1px;gap:0;border-width:calc(2px / 1.5);border-radius:calc(8px / 1.5);font-size:8px;line-height:1;scroll-snap-align:none}
:is(.school-squares--group,.school-squares--client)>.school-square strong{font-size:9px;line-height:1;white-space:nowrap}
:is(.school-squares--group,.school-squares--client)>.school-square small{font-size:7.5px;line-height:1}
:is(.school-squares--group,.school-squares--client)>.school-square span{font-size:10px;line-height:1}
:is(.school-squares--group,.school-squares--client)>.school-square span:empty{display:none}
:is(.school-squares--group,.school-squares--client)>p{grid-column:1/-1}
@container(max-width:900px){.school-squares:is(.school-squares--group,.school-squares--client){grid-template-columns:repeat(auto-fill,minmax(min(100%,42.6667px),42.6667px));width:100%}}
.school-negative{color:#bb1536;font-weight:700}
.school-lesson-dialog{width:min(760px,94vw);max-height:90vh;overflow:auto;border:1px solid #cad4df;border-radius:14px;padding:20px}
.school-lesson-dialog .lesson-student{display:flex;gap:12px;flex-wrap:wrap;align-items:center;padding:12px;border-bottom:1px solid #eee}
.school-lesson-dialog .lesson-student strong{min-width:140px}
/* Clear, touch-friendly lesson actions with a permanently visible footer. */
.school-squares .school-square:hover{background:var(--square-bg,#f1f4f8);filter:brightness(.97);box-shadow:0 0 0 2px #58786355;transform:none}
.school-squares .school-square[aria-expanded=true]{box-shadow:0 0 0 2px #195b40}
.school-square.state-present,.school-square.is-covered{--square-bg:#dbf4e5}
.school-square.state-absent{--square-bg:#ffe8ed}
.school-square.state-unmarked{--square-bg:#eee}
.school-square.state-excused{--square-bg:#e3ecff}
.school-square.state-makeup{--square-bg:#eae1ff}
.school-square.state-waiting{--square-bg:#fff0b2}
.school-square.state-partial{--square-bg:linear-gradient(90deg,#dbf4e5 50%,#fff0b2 50%)}
.school-lesson-dialog{width:min(820px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - 24px);padding:0;overflow:hidden;box-sizing:border-box;box-shadow:0 20px 70px #10261c33}
.school-lesson-dialog[open]{display:flex;flex-direction:column}
.lesson-popup-header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 20px;border-bottom:1px solid #e1e8e1;flex-shrink:0}
.lesson-popup-header h3{margin:0 0 8px;font-size:20px;overflow-wrap:anywhere}
.school-lesson-dialog .lesson-popup-close{width:44px;min-width:44px;height:44px;padding:0;font-size:28px;line-height:1}
.school-lesson-dialog [data-attendance-sheet]{display:flex;flex-direction:column;min-height:0;overflow:hidden;margin:0}
.lesson-popup-body{overflow:auto;overscroll-behavior:contain;padding:14px 20px;min-height:0}
.lesson-popup-body>p{font-size:13px;line-height:1.5;margin:0 0 8px}
.lesson-popup-footer{flex-shrink:0;padding:12px 20px;border-top:1px solid #dce5dc;background:#fff}
.lesson-popup-footer [data-result]{font-size:13px;line-height:1.5;margin:0 0 10px;overflow-wrap:anywhere}
.lesson-popup-footer [data-result][role=alert]{color:#a92535}
.lesson-popup-footer [data-result]:focus{outline:none}
.lesson-popup-footer [data-reload]{margin-bottom:10px}
.lesson-popup-actions{display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:8px}
.school-lesson-dialog button{min-height:44px;white-space:normal;font-size:13px;line-height:1.3;transform:none}
.lesson-popup-actions button{padding:10px 12px;min-width:0}
.school-lesson-dialog .lesson-danger{background:#fff1f2;color:#a92236;border:1px solid #efbdc5}
.school-lesson-dialog .lesson-danger:hover:not(:disabled){background:#ffe0e5}
.school-lesson-dialog button:disabled,.school-lesson-dialog input:disabled,.school-lesson-dialog select:disabled{cursor:not-allowed}
.school-lesson-dialog[aria-busy=true] button:disabled{cursor:wait}
.lesson-sheet-tools{padding:12px;margin:14px 0;background:#f3f7f2;border:1px solid #e0e8dc;border-radius:10px;display:flex;flex-direction:column;gap:8px}
.lesson-sheet-tools>div{display:flex;flex-wrap:wrap;gap:8px}
.lesson-sheet-tools button{flex:1 1 auto;padding:8px 12px}
.lesson-sheet-tools [data-sheet-summary]{font-size:13px}
.lesson-sheet-tools [data-dirty]{font-size:12px;color:#5e7063}
.school-lesson-dialog .lesson-student,.school-lesson-dialog .lesson-sheet-head{display:grid;grid-template-columns:minmax(0,2fr) minmax(85px,1fr) minmax(115px,1fr);gap:12px;align-items:center;padding:10px 0;margin:0;border-bottom:1px solid #e2e8e0;font-size:13px}
.school-lesson-dialog .lesson-student>label{min-height:44px;cursor:pointer;overflow-wrap:anywhere}
.school-lesson-dialog input:not([type=checkbox]),.school-lesson-dialog select{min-height:44px}
.school-lesson-dialog .lesson-absence{grid-column:1/-1}
.lesson-decision{padding:12px;margin-bottom:10px;border:1px solid #e5bdc5;border-radius:10px;background:#fff8f8}
.lesson-decision[hidden]{display:none}
.lesson-decision p{font-size:13px;line-height:1.5;margin:0 0 10px}
.lesson-decision>div{display:flex;flex-wrap:wrap;gap:8px}
.lesson-decision button{flex:1 1 160px}
@media(max-width:600px){.school-lesson-dialog{width:calc(100vw - 12px);max-height:calc(100dvh - 12px)}.lesson-popup-header,.lesson-popup-body{padding:12px}.lesson-popup-footer{padding:10px 12px max(10px,env(safe-area-inset-bottom))}.lesson-popup-actions{grid-template-columns:1fr 1fr}.lesson-popup-actions [data-conduct]{grid-column:1/-1}.school-lesson-dialog .lesson-sheet-head{display:none}.school-lesson-dialog .lesson-student{grid-template-columns:1fr 1fr;gap:8px}.school-lesson-dialog .lesson-student>label{grid-column:1/-1}.lesson-sheet-tools{padding:10px}.school-lesson-dialog input:not([type=checkbox]),.school-lesson-dialog select{font-size:16px}}
/* One predictable return position, separate from editing and destructive actions. */
.crm-return-bar{position:sticky;top:0;z-index:12;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-shrink:0;padding:10px 0;margin:0 0 14px;background:#fff;border-bottom:1px solid #dce5dc;box-sizing:border-box}
.crm-return-bar>.crm-back-button{display:inline-flex;align-items:center;gap:8px;min-height:44px;max-width:100%;margin:0;padding:10px 14px;border-radius:10px;text-align:left;white-space:normal;font-size:14px;line-height:1.3;flex:0 1 auto;transform:none}
.crm-return-bar>.crm-back-button>span[aria-hidden]{font-size:21px;line-height:1}
.crm-return-bar>span{font-size:11px;color:#627568}
.crm-return-bar>.crm-back-button:focus-visible{outline:3px solid #477943;outline-offset:2px}
.crm-card{padding-top:0}
.crm-card>.crm-return-bar{margin:0 -20px 16px;padding:10px 20px;background:#f6f8f4}
.school-workspace>.crm-return-bar{background:#f8faf7}
.school-lesson-dialog>.crm-return-bar{padding:10px 20px;margin:0;z-index:14}
.school-lesson-dialog .lesson-popup-header{padding-top:12px;padding-bottom:12px}
.school-drawer{padding-top:0}
.school-drawer>.crm-return-bar{margin:0 -25px 16px;padding:10px 25px}
.crm-return-bar>.drawer-close{float:none;position:static;top:auto}
.school-drawer .lesson-title{padding-right:0}
.crm-usage-dialog:has(>.crm-return-bar){padding:0 20px 20px}
.crm-usage-dialog>.crm-return-bar{margin:0 -20px 16px;padding:10px 20px}
#quick{padding:0;max-height:calc(100dvh - 24px);overflow:hidden;box-sizing:border-box}
#quick[open]{display:flex;flex-direction:column}
#quick>.crm-return-bar{padding:10px 20px;margin:0}
#quickForm{display:flex;flex-direction:column;min-height:0;overflow:hidden;margin:0}
#quick .quick-form-body{overflow:auto;overscroll-behavior:contain;padding:0 24px 16px;min-height:0}
#quickTitle{margin:16px 0}
#quick .quick-form-actions{display:flex;gap:8px;flex-shrink:0;margin:0;padding:14px 24px;border-top:1px solid #dce5dc;background:#fff}
#quick .quick-form-actions button{flex:1;min-height:44px}
@media(max-width:1024px){.crm-card{padding-top:0}.crm-card>.crm-return-bar{margin:0 -14px 14px;padding:10px 14px}}
@media(max-width:700px){.school-drawer{padding-top:0}.school-drawer>.crm-return-bar{margin:0 -18px 14px;padding:10px 18px}}
@media(max-width:600px){.crm-return-bar>span{display:none}.school-lesson-dialog>.crm-return-bar,#quick>.crm-return-bar{padding:8px 12px}#quick{max-height:calc(100dvh - 12px)}#quick .quick-form-body{padding:0 16px 12px}#quick .quick-form-actions{padding:12px 16px max(12px,env(safe-area-inset-bottom))}}

/* Client payment coverage uses the same compact calendar grid as group history. */
.school-client-attendance{min-width:0;max-width:100%}
.school-client-tracks{display:grid;gap:14px;min-width:0}
.school-client-track>h4{font-size:14px;line-height:1.4;margin:12px 0 0;overflow-wrap:anywhere}
.school-client-filters,.school-visit-dates{display:flex;align-items:end;flex-wrap:wrap;gap:10px}
.school-client-filters label,.school-visit-dates label{display:flex;flex-direction:column;gap:6px;max-width:100%;font-size:12px}
.school-client-filters select,.school-visit-dates input{max-width:100%;min-height:44px}
.school-visit-dates{margin-bottom:10px}.school-visit-dates>button{min-height:44px}
.school-client-summary{margin-top:14px;padding-top:12px;border-top:1px solid #e1e8de}
.school-client-summary .crm-facts{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px 12px;max-width:440px;font-size:13px}
.school-client-summary .school-hint{margin-bottom:0}
@media(max-width:600px){.school-client-filters label{flex:1 1 130px}.school-visit-dates label{flex:1 1 110px}.school-client-filters select,.school-visit-dates input{width:100%;font-size:16px}}

.crm-card-header>div{min-width:0;max-width:100%}
.crm-card-header label{min-width:0;max-width:100%;flex-wrap:wrap}
.crm-card-header label select{min-width:0;max-width:100%;flex:1 1 140px}
