/* A single focused screen for writing, with a clear destination and one main action. */
.material-window, .material-viewer-window, .material-delete-window { scrollbar-gutter: stable; }
.material-toolbar { min-height: 70px; }
.material-toolbar > span { font-size: 11px; letter-spacing: .1px; }
.material-toolbar i { font-style: normal; padding-inline: 6px; opacity: .5; }
.material-body { max-width: 740px; padding-top: 36px; padding-bottom: 0; }
.material-heading { margin-bottom: 30px; }
.material-heading .eyebrow { font-size: 9px; color: var(--text-2); letter-spacing: 1.4px; margin-bottom: 12px; }
.material-heading .eyebrow > span { letter-spacing: 0; color: var(--text-3); }
.material-heading h1 { font-size: 32px; font-weight: 700; letter-spacing: -1.2px; line-height: 1.25; }
.material-heading > p:last-child:not(.eyebrow) { color: var(--text-2); font-size: 13px; line-height: 1.8; margin-top: 10px; }
.material-conflict { padding:20px; border:1px solid var(--glass-rim); border-radius:18px; margin-bottom:24px; background:var(--surface); }
.material-conflict h2 { font-size:18px; margin-bottom:8px; }
.material-conflict p { color:var(--text-2); font-size:12px; line-height:1.6; }
.material-conflict pre { white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; font-size:12px; line-height:1.7; max-height:200px; overflow:auto; margin:16px 0; }
.material-choices { display: grid; gap: 14px; padding-bottom: 40px; }
.material-choices > button { width: 100%; display: flex; align-items: center; gap: 17px; padding: 25px; border: 1px solid var(--glass-rim); border-radius: 23px; text-align: left; background: var(--surface); box-shadow: inset 0 1px var(--glass-highlight); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.material-choices > button:hover { background: var(--surface-2); border-color: var(--text-3); }
.material-choice-icon { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border: 1px solid var(--hairline-strong); border-radius: 14px; background: var(--surface-2); }
.material-choice-icon .ic { width: 23px; height: 23px; }
.material-choices > button > span:nth-child(2) { flex: 1; display: grid; gap: 7px; }
.material-choices b { font-size: 16px; font-weight: 700; }
.material-choices small { font-size: 12px; color: var(--text-2); }
.material-choices > button > .ic { width: 18px; height: 18px; color: var(--text-3); }
.material-field { margin-bottom: 24px; }
#material-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.material-window button:disabled { opacity: .5; cursor: default; }
[data-keyboard="open"] .material-window { height: calc(100dvh - var(--keyboard-inset, 0px)); max-height: calc(100dvh - var(--keyboard-inset, 0px)); }
.material-field > label, .material-label-row > label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 9px; }
.material-subject-select { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 15px; text-align: left; border: 1px solid var(--glass-rim); border-radius: 17px; background: var(--surface); box-shadow: inset 0 1px var(--glass-highlight); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.material-subject-select > span:nth-child(2) { flex: 1; font-size: 14px; line-height: 1.65; }
.material-subject-select > .ic { width: 17px; height: 17px; color: var(--text-3); }
.material-subject-select .subject-icon { width: 36px; height: 36px; border-radius: 11px; }
.material-subject-empty { color: var(--text-3); display: grid; place-items: center; width: 36px; height: 36px; }
.material-subject-empty .ic { width: 22px; height: 22px; }
.material-subject-select:hover, .material-upload:hover { background: var(--surface-2); border-color: var(--text-3); }
.material-date-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.material-date-help { color: var(--text-2); font-size: 12px; line-height: 1.8; padding: 9px 0 2px; }
.material-date-chip { padding: 10px 13px; min-height: 42px; border: 1px solid var(--glass-rim); border-radius: 12px; background: var(--surface); font-size: 12px; font-weight: 600; white-space: nowrap; }
.material-date-chip.is-selected { border-color: var(--text-3); background: var(--surface-3); color: var(--heading); box-shadow: inset 0 1px var(--glass-highlight); }
.material-date-row input { display: block; width: 153px; min-width: 0; max-width: 100%; min-height: 42px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--glass-rim); border-radius: 12px; font: 13px var(--font); color: var(--text); }
.material-date-row input::-webkit-calendar-picker-indicator { opacity: .65; cursor: pointer; }
.material-writing { border: 1px solid var(--glass-rim); border-radius: 19px; background: var(--surface); box-shadow: inset 0 1px var(--glass-highlight); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); overflow: hidden; }
.material-writing:focus-within { border-color: var(--text-3); box-shadow: inset 0 1px var(--glass-highlight), 0 0 0 3px var(--surface-2); }
.material-writing.is-dragging { border-color: var(--text); box-shadow: 0 0 0 4px var(--surface-3); }
.material-writing textarea { display: block; width: 100%; min-height: 160px; max-height: 55vh; border: 0; outline: 0; resize: vertical; padding: 17px 18px 10px; font: 14px/1.85 var(--font); color: var(--heading); background: transparent; }
.material-writing textarea::placeholder { color: var(--text-3); opacity: 1; }
.material-writing-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px 10px 18px; font-size: 10px; color: var(--text-3); }
.material-writing-footer:has(#material-counter:empty), .material-hint:empty { display: none; }
.material-label-row.material-text-label { align-items: center; margin-bottom: 9px; }
.material-text-label > label:first-child { margin: 0; }
.material-text-label .material-upload-inline { margin: 0; flex: none; white-space: nowrap; font-size: 11px; font-weight: 650; color: var(--text); }
.material-upload-inline { position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 8px 11px; border-radius: 11px; border: 1px solid var(--glass-rim); background: var(--surface-2); color: var(--text); font-size: 11px; font-weight: 650; cursor: pointer; }
.material-upload-inline .ic { width: 16px; height: 16px; }
.material-hint, .material-past { font-size: 10px; line-height: 1.8; color: var(--text-3); margin: 8px 1px 0; }
.material-past { color: var(--text-2); }
.material-error { font-size: 11px; line-height: 1.7; color: var(--red); margin-top: 7px; overflow-wrap: anywhere; }
.material-error:empty { display: none; }
.material-subject-select.is-invalid { border-color: var(--red); }
.material-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.material-label-row > span { font-size: 10px; color: var(--text-3); }
.material-field > label.material-upload { position: relative; display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 54px; padding: 10px 15px; margin-bottom: 0; border: 1px dashed var(--hairline-strong); border-radius: 15px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 12px; font-weight: 600; }
.material-upload > .ic { width: 18px; height: 18px; }
.material-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.material-file-list { padding: 0; margin: 0 0 12px; list-style: none; display: grid; gap: 8px; }
.material-file-list > li { display: flex; align-items: center; gap: 11px; border: 1px solid var(--glass-rim); background: var(--surface); border-radius: 15px; padding: 9px; }
.material-file-preview { width: 49px; height: 56px; display: grid; place-items: center; background: var(--surface-2); border-radius: 9px; flex: none; overflow: hidden; }
.material-file-preview img { width: 100%; height: 100%; object-fit: cover; }
.material-file-preview .ic { width: 22px; height: 22px; color: var(--text-2); }
.material-file-info { display: grid; gap: 5px; flex: 1; min-width: 0; }
.material-file-info b { font-size: 11px; font-weight: 650; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.material-file-info small { font-size: 9px; color: var(--text-3); }
.material-file-tools { display: flex; align-items: center; }
.material-file-tools > button { width: 32px; height: 40px; display: grid; place-items: center; background: transparent; border-radius: 8px; color: var(--text-2); }
.material-file-tools > button:hover { background: var(--surface-3); }
.material-file-tools .ic { width: 15px; height: 15px; }
.material-file-tools [data-material="move"] .ic { transform: rotate(90deg); }
.material-file-tools > button:last-child { margin-left: 5px; }
.material-bottom { position: sticky; z-index: 4; bottom: 0; padding: 15px 0 calc(19px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 76%, transparent); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border-top: 1px solid var(--glass-rim); display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.material-bottom-copy { display: grid; gap: 6px; color: var(--text-3); font-size: 10px; line-height: 1.7; }
.material-bottom-copy > button { color: var(--text-2); background: transparent; font-size: 10px; padding: 0; width: fit-content; text-decoration: underline; text-underline-offset: 3px; }
.material-save { min-height: 48px; padding: 12px 20px; flex: none; border: 1px solid #fff9; border-radius: 14px; background: #e4e7ee; color: #222731; font-size: 12px; font-weight: 750; box-shadow: inset 0 1px #fff; }
.material-save:hover { background: #f0f2f7; }
.material-save .ic { width: 16px; height: 16px; margin-left: 10px; }
.material-save-error { margin: 0; max-width: 340px; }
.material-subject-search { width: 100%; margin-bottom: 18px; min-height: 49px; }
.material-subject-results { display: grid; gap: 7px; padding-bottom: 30px; }
.material-subject-option { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 65px; padding: 12px 14px; text-align: left; border: 1px solid var(--glass-rim); border-radius: 15px; background: var(--surface); }
.material-subject-option > span:nth-child(2) { flex: 1; min-width: 0; font-size: 13px; line-height: 1.7; }
.material-subject-option .subject-icon { width: 35px; height: 35px; border-radius: 10px; }
.material-subject-option > .ic { width: 16px; height: 16px; color: var(--text-3); }
.material-subject-option:hover { background: var(--surface-2); border-color: var(--text-3); }
.material-loading { padding-block: 100px; text-align: center; color: var(--text-2); font-size: 13px; }
.material-published-files { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 27px; }
.material-published-file { position: relative; display: flex; align-items: center; gap: 11px; min-height: 90px; padding: 17px; border: 1px solid var(--glass-rim); border-radius: 15px; background: var(--surface); text-align: left; overflow: hidden; }
.material-published-file > .ic:first-child { flex: none; width: 24px; height: 24px; color: var(--text-2); }
.material-published-file > .ic:last-child { flex: none; margin-left: auto; width: 15px; height: 15px; color: var(--text-3); }
.material-published-file span { display: grid; gap: 6px; min-width: 0; }
.material-published-file b { font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.material-published-file small { font-size: 10px; color: var(--text-3); }
.material-published-file.is-photo { padding: 0; aspect-ratio: 4 / 3; }
.material-published-file.is-photo img { width: 100%; height: 100%; object-fit: cover; }
.material-published-file.is-photo > .ic:last-child { position: absolute; right: 10px; bottom: 10px; color: #fff; filter: drop-shadow(0 1px 3px #000); }
.material-viewer { padding-bottom: 25px; }
.material-viewer-heading { display: flex; gap: 20px; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.material-viewer h1 { font-size: 19px; line-height: 1.6; overflow-wrap: anywhere; }
.material-viewer-heading > span { flex: none; font-size: 11px; color: var(--text-3); }
.material-viewer-image { display: block; width: 100%; max-height: 68dvh; object-fit: contain; background: #0c0d1180; border-radius: 16px; }
.material-viewer-pdf { width: 100%; height: 66dvh; border: 1px solid var(--glass-rim); border-radius: 14px; background: var(--surface); }
.material-viewer-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.material-viewer-actions .btn { font-size: 11px; }
.material-delete { width: min(100%,480px); margin: 35px auto 65px; }
.material-delete-mark { display: grid; place-items: center; width: 49px; height: 49px; border-radius: 15px; border: 1px solid var(--glass-rim); background: var(--surface-2); margin-bottom: 25px; }
.material-delete-mark .ic { width: 23px; height: 23px; }
.material-delete h1 { font-size: 29px; letter-spacing: -1px; line-height: 1.4; }
.material-delete > p { color: var(--text-2); font-size: 13px; line-height: 1.9; margin-top: 12px; }
.material-delete-summary { padding: 21px; margin-top: 25px; border: 1px solid var(--glass-rim); border-radius: 19px; background: var(--surface); display: grid; gap: 12px; }
.material-delete-summary b { font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.material-delete-summary span { font-size: 11px; color: var(--text-2); line-height: 1.8; }
.material-delete-actions { display: flex; gap: 10px; margin-top: 28px; }
.material-delete-actions .btn { flex: 1; min-height: 46px; font-size: 12px; }
[data-theme="light"] .material-save { background: #383c46; border-color: #30343e; color: #fff; box-shadow: inset 0 1px #ffffff26; }
[data-theme="light"] .material-save:hover { background: #282d37; }
[data-theme="light"] :is(.material-writing,.material-subject-select,.material-choices > button,.material-subject-option,.material-file-list > li) { background: #ffffffb3; box-shadow: var(--daylight-shadow), inset 0 1px #fff; }
[data-theme="light"] .material-date-chip.is-selected { background: #fff; border-color: #67718377; }
@media (max-width:760px) {
  .material-body { padding: 25px 20px 0; }
  .material-heading { margin-bottom: 25px; }
  .material-heading h1 { font-size: 28px; letter-spacing: -.9px; }
  .material-heading > p:last-child:not(.eyebrow) { font-size: 12px; }
  .material-heading .eyebrow { font-size: 8px; margin-bottom: 10px; }
  .material-choices > button { padding: 20px 16px; gap: 13px; }
  .material-choices b { font-size: 14px; }
  .material-choices small { font-size: 10px; }
  .material-choice-icon { width: 40px; height: 40px; border-radius: 12px; }
  .material-field { margin-bottom: 22px; }
  .material-subject-select { min-height: 62px; padding: 11px 13px; }
  .material-subject-select > span:nth-child(2) { font-size: 13px; }
  .material-writing textarea { font-size: 16px; min-height: 128px; padding: 15px 16px 8px; }
  .material-writing textarea::placeholder { font-size: 13px; }
  .material-date-row { gap: 7px; }
  .material-date-chip { font-size: 11px; padding-inline: 11px; }
  .material-date-row input { width: 147px; font-size: 16px; padding: 7px 9px; }
  .material-bottom { flex-direction: column-reverse; gap: 11px; align-items: stretch; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .material-save { width: 100%; justify-content: space-between; min-height: 49px; font-size: 13px; }
  .material-bottom-copy { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; text-align: center; font-size: 9px; }
  .material-bottom-copy > button { font-size: 9px; }
  .material-file-info b { font-size: 10px; }
  .material-file-tools > button { width: 44px; min-height: 44px; }
  .material-file-tools > button:last-child { margin-left: 0; }
  .material-file-preview { width: 42px; height: 51px; }
  .material-file-list > li { gap: 9px; }
  .material-published-files { gap: 9px; }
  .material-published-file:not(.is-photo) { grid-column: 1 / -1; }
  .material-delete { margin-top: 22px; }
  .material-delete h1 { font-size: 26px; }
  .material-viewer h1 { font-size: 16px; }
}
@media (max-width:360px) {
  .material-body { padding-inline: 16px; }
  .material-date-row input { width: 100%; }
}
/* Timetable uses the same full-screen form and glass controls as materials. */
.schedule-fieldset { border:0; padding:0; margin:0; min-width:0; }
.schedule-editor-days { display:flex; gap:6px; flex-wrap:wrap; }
.schedule-editor-days > button { min-width:48px; }
.schedule-editor-day { margin:26px 0 16px; font-size:20px; }
.schedule-editor-row { display:grid; grid-template-columns:180px 1fr 40px; align-items:end; gap:12px; border-bottom:1px solid var(--line); padding:0 0 18px; margin-bottom:18px; }
.schedule-editor-times { display:flex; gap:8px; }
.schedule-editor-row label { display:grid; min-width:0; gap:7px; font-size:11px; color:var(--text-2); }
.schedule-editor-times label { flex:1; }
.schedule-editor-row input { width:100%; min-width:0; box-sizing:border-box; padding:11px 8px; border:1px solid var(--glass-rim); background:var(--surface); border-radius:10px; color:var(--text); font:inherit; font-size:13px; }
.schedule-editor-row .icon-btn { height:44px; }
.schedule-import { margin-top:24px; }
@media(max-width:600px){ .schedule-editor-row {grid-template-columns:1fr 44px; gap:10px;} .schedule-editor-times{grid-column:1;} .schedule-editor-subject{grid-column:1;grid-row:2;} .schedule-editor-row > button{grid-column:2;grid-row:2;} }
