/* Homework uses the same panel, inset and spacing tokens as the other pages. */
.hw-layout{--hw-control:44px;display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:var(--content-gap);align-items:start;width:100%;min-width:0}
.hw-layout *{box-sizing:border-box}
.hw-editor{display:flex;flex-direction:column;gap:20px;min-width:0}
.hw-context,.hw-book,.hw-preview-panel{min-width:0;background:#fff;border:1px solid var(--line);border-radius:var(--panel-radius)}
.hw-context{padding:var(--panel-inset)}
.hw-field{display:flex;flex-direction:column;gap:8px;margin:0;min-width:0;color:var(--muted);font-size:12px;line-height:1.6}
.hw-field input,.hw-field select,.hw-field textarea,.hw-day-heading input,.hw-day-row textarea{display:block;width:100%;min-width:0;max-width:100%;border:1px solid #dce3ec;border-radius:9px;background:#fff;color:var(--ink);font:inherit;font-size:14px;line-height:1.7;padding:10px 12px;box-shadow:none}
.hw-field input,.hw-field select,.hw-day-heading input{min-height:var(--hw-control)}
.hw-field textarea,.hw-day-row textarea{min-height:120px;resize:vertical;scroll-margin-block:80px 160px}
.hw-field input[type=date],.hw-day-heading input[type=date]{appearance:none;-webkit-appearance:none;text-align:left}
.hw-field input[type=date]::-webkit-date-and-time-value,.hw-day-heading input[type=date]::-webkit-date-and-time-value{text-align:left;min-width:0}
.hw-layout input:focus-visible,.hw-layout textarea:focus-visible,.hw-layout select:focus-visible{outline:2px solid #8da6c8;outline-offset:2px;border-color:#9bafc9}
.hw-student select{font-size:17px;font-weight:600}
.hw-dates{margin-top:16px;padding-top:12px;border-top:1px solid #edf0f4}
.hw-layout summary{cursor:pointer;color:#53677f;font-size:13px;line-height:1.7;min-height:36px;padding:7px 0;overflow-wrap:anywhere}
.hw-dates summary>span{font-weight:500;color:var(--ink)}
.hw-dates summary>small{display:block;margin:4px 0 0 16px;font-size:12px;color:var(--muted)}
.hw-date-fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;padding-top:14px}
.hw-history,.hw-more,.hw-trash{min-width:0;margin:0;padding:0}
.hw-history>summary>span{margin-left:5px;padding:2px 7px;border-radius:5px;background:#e9eef5;font-size:11px;font-variant-numeric:tabular-nums}
.hw-saved-list,.hw-draft-list{margin-top:10px;background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden}
.hw-saved-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;padding:12px 16px;border-bottom:1px solid #edf0f4}
.hw-saved-row:last-child{border-bottom:0}
.hw-saved-row>button:first-child:not(.hw-delete){display:flex;flex:1;min-width:0;flex-direction:column;gap:4px;padding:5px 0;text-align:left}
.hw-saved-row strong{font-size:13px;font-weight:500;color:var(--ink);line-height:1.7}
.hw-saved-row span{font-size:12px;line-height:1.7;color:var(--muted);overflow-wrap:anywhere}
.hw-delete{flex-shrink:0;min-width:44px;min-height:44px;padding:8px!important;color:#995e60!important;font-size:12px!important;line-height:1.5}
.hw-books{display:flex;flex-direction:column;gap:20px;min-width:0}
.hw-books:empty{display:none}
.hw-book{overflow:hidden}
.hw-book-heading{display:flex;align-items:center;gap:12px;padding:16px var(--panel-inset) 8px;min-width:0}
.hw-book-heading>input{flex:1;min-width:0;width:0;min-height:44px;padding:6px 0;border:0;border-radius:3px;background:transparent;color:var(--ink);font-size:18px;font-weight:600;line-height:1.6}
.hw-book-body{display:flex;flex-direction:column;align-items:stretch;gap:16px;min-width:0;padding:0 var(--panel-inset) var(--panel-inset)}
.hw-mode{display:flex;align-items:center;gap:8px;align-self:flex-start;max-width:100%}
.hw-mode button{min-height:36px;padding:7px 12px;border:1px solid #e0e6ee;border-radius:8px;color:#758399;font-size:12px;line-height:1.6;white-space:nowrap}
.hw-mode button[aria-pressed=true]{border-color:#d5e0ed;background:#edf2f8;color:#254363;font-weight:600}
.hw-notes{margin:0;padding-top:10px;border-top:1px solid #edf0f4}
.hw-notes summary{font-size:12px}
.hw-notes .hw-field{padding-top:8px}
.hw-notes textarea{min-height:88px}
.hw-generator{margin:0;padding:0;border-bottom:1px solid #edf0f4}
.hw-generator summary{font-size:12px}
.hw-generator-fields{display:flex;flex-direction:column;gap:14px;padding:10px 0 18px}
.hw-number-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.hw-check{display:flex;align-items:center;gap:8px;margin:0;font-size:12px;line-height:1.7;color:var(--muted)}
.hw-check input{width:16px;height:16px;accent-color:var(--navy)}
.hw-generator-fields>.button{align-self:flex-start;font-size:12px;min-height:42px}
.hw-day-list{display:flex;flex-direction:column;gap:20px;min-width:0}
.hw-day-row{min-width:0}
.hw-day-heading{display:flex;align-items:center;gap:10px;margin-bottom:9px;min-width:0}
.hw-day-heading>label{flex:0 1 190px;min-width:0}
.hw-day-heading>small{font-size:11px;color:var(--muted);white-space:nowrap}
.hw-day-heading>.icon-button{width:36px;min-width:36px;height:36px;margin-left:auto;color:#8797aa}
.hw-add-day{display:flex;align-items:center;gap:6px;align-self:flex-start;min-height:40px;font-size:12px}
.hw-add-day svg{width:14px;height:14px}
.hw-add-book{display:flex;align-items:center;flex-wrap:wrap;gap:12px 18px;margin:0;min-width:0}
.hw-add-book>.button{font-size:13px;min-height:44px}.hw-add-book>.text-button{font-size:12px;min-height:44px}
.hw-more>.hw-field{margin:10px 0 16px}.hw-trash{margin-top:12px}
.hw-error{margin:0;color:#a05452;font-size:12px;line-height:1.8;overflow-wrap:anywhere}.hw-error:empty{display:none}
.hw-error>.button{display:block;margin-top:10px}
.hw-local-status{margin:0;min-height:18px;color:#7f8da1;font-size:11px;line-height:1.7}.hw-local-status:empty{display:none}
.hw-preview-panel{position:sticky;top:32px;overflow:visible}
.hw-preview-toggle{display:flex;align-items:center;gap:10px;width:100%;min-height:58px;padding:16px 20px;text-align:left;color:var(--ink);font-size:13px;font-weight:500;border-radius:var(--panel-radius) var(--panel-radius) 0 0}
.hw-preview-toggle>svg{width:15px;height:15px;flex-shrink:0;transform:rotate(90deg);color:#8190a4}
.hw-preview-panel.is-open .hw-preview-toggle>svg{transform:rotate(-90deg)}
#hw-page-count{margin-left:auto;min-width:52px;text-align:right;color:#8190a4;font-size:11px;font-weight:400;white-space:nowrap;font-variant-numeric:tabular-nums}
.hw-image-options{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:12px 20px;border-top:1px solid #edf0f4}.hw-image-options>span{font-size:12px;color:var(--muted)}.hw-image-options .hw-mode{margin-left:auto}.hw-image-options>small{flex-basis:100%;font-size:11px;line-height:1.7;color:var(--muted)}
.hw-preview{display:none;height:clamp(180px,62dvh,620px);max-height:calc(100dvh - 280px);overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;background:#edf1f6;padding:16px;border-top:1px solid #e5eaf1}
.hw-preview-panel.is-open .hw-preview{display:block}
.hw-image-page{margin:0 0 16px;border:1px solid #e1e7ef;border-radius:7px;overflow:hidden;background:#fff;box-shadow:0 2px 8px #142b4a08}.hw-image-page:last-child{margin-bottom:0}.hw-image-page>img{display:block;width:100%;height:auto}.hw-image-page figcaption{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;padding:8px 12px;border-top:1px solid #edf0f4}.hw-image-page figcaption>span{font-size:10px;line-height:1.7;color:var(--muted)}.hw-image-page figcaption>.text-button{min-height:36px;font-size:11px;white-space:nowrap}
.hw-preview-empty{display:grid;place-content:center;height:100%;padding:16px;text-align:center;color:#8190a4;font-size:12px;line-height:1.8}
.hw-export{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:16px;border-top:1px solid var(--line)}
.hw-export .button{min-width:0;min-height:44px;padding:10px 8px;font-size:12px;white-space:nowrap}
.hw-mobile-save{display:none}
.hw-native-fallback img{display:block;width:100%;height:auto;margin-bottom:18px}.hw-native-fallback p{font-size:13px;color:var(--muted);line-height:1.9}
.hw-copy-fallback{width:100%;min-height:300px;font-size:14px;line-height:1.9}
.lesson-homework-action{display:flex;align-items:center;flex-wrap:wrap;gap:14px;margin-top:16px}.lesson-homework-action>.button{font-size:13px}
@media(max-width:1180px){
 .hw-layout{grid-template-columns:minmax(0,1fr)}
 .hw-preview-panel{position:static;top:auto}
 .hw-preview{height:480px}
 .hw-export{grid-template-columns:1fr 1fr}
}
@media(max-width:680px),(max-width:960px) and (pointer:coarse) and (max-height:600px){
 #nav.app-menu{grid-template-columns:repeat(5,minmax(0,1fr));padding-left:7px;padding-right:7px}
 .hw-layout{gap:var(--content-gap)}
 .hw-editor,.hw-books{gap:18px}
 .hw-field input,.hw-field select,.hw-field textarea,.hw-day-heading input,.hw-day-row textarea{font-size:16px;padding:10px 11px}
 .hw-student select{font-size:17px}
 .hw-book-heading{gap:8px;padding-top:12px}.hw-book-heading>input{font-size:17px}
 .hw-book-body{gap:14px}
 .hw-dates summary>small{font-size:11px}
 .hw-day-heading{gap:8px}.hw-day-heading>label{flex-basis:168px}.hw-day-heading>small{font-size:10px}
 .hw-day-heading>.icon-button{width:32px;min-width:32px}
 .hw-number-grid{gap:8px}
 .hw-preview-toggle{min-height:56px;padding:14px var(--panel-inset)}
 .hw-preview{height:400px;padding:12px}
 .hw-desktop-save{display:none!important}.hw-mobile-save{display:block}
 .hw-export{position:fixed;left:0;right:0;bottom:calc(65px + var(--safe-bottom));z-index:48;grid-template-columns:1fr 1fr 1.2fr;gap:8px;min-height:66px;padding:10px calc(18px + var(--safe-right)) 10px calc(18px + var(--safe-left));border-top:1px solid var(--line);background:#fff;box-shadow:none}
 #app:has(.hw-layout){padding-bottom:calc(170px + var(--safe-bottom))}
 #app:has(.hw-layout)~#toast,body:has(.hw-layout) #toast{bottom:calc(145px + var(--safe-bottom))}
 .hw-copy-fallback{font-size:16px}
}
@media(max-width:360px){
 .hw-date-fields{grid-template-columns:minmax(0,1fr)}
 .hw-book-heading>input{font-size:16px}.hw-book-heading{gap:4px}
 .hw-mode{gap:6px}.hw-mode button{padding-left:10px;padding-right:10px}
 .hw-day-heading{gap:6px}.hw-day-heading>label{flex-basis:150px}
 .hw-export{gap:6px;padding-left:calc(14px + var(--safe-left));padding-right:calc(14px + var(--safe-right))}.hw-export .button{font-size:11px}
}

.hw-image-options .hw-date-export{flex-basis:100%;display:grid;grid-template-columns:1fr 1fr;margin:0}.hw-date-export button{min-height:40px}
