/* Unified top surface extends into the safe area; content passes beneath it. */
:root{--header-height:106px;--header-glass:rgba(244,245,247,.82)}[data-theme=dark]{--header-glass:rgba(23,24,28,.84)}
html,body{background:var(--bg)}.main-col{isolation:isolate}.hd{position:absolute;inset:0 0 auto;z-index:45;background:var(--header-glass);backdrop-filter:blur(24px) saturate(140%);-webkit-backdrop-filter:blur(24px) saturate(140%);border-bottom:1px solid color-mix(in srgb,var(--line2) 45%,transparent)}
.scroll{padding-top:calc(var(--header-height) + 12px);scroll-padding-top:calc(var(--header-height) + 12px)}.app.detail-mode .scroll{padding-top:calc(15px + var(--safe-top))}
.desktop-route-bar{display:none}
.icon-badge[class*="tone-"]{color:var(--icon-fg);background:var(--icon-bg)}
[data-theme=dark] .tone-gray{--icon-bg:#32353e;--icon-fg:#bdc2cf}
[data-theme=dark] .logout-btn{background:#35272e;color:#ff929f;border:1px solid #69404a;box-shadow:none}
[data-theme=dark] .logout-btn:hover{background:#422c34}
[data-theme=dark] .hd-avatar,[data-theme=dark] .avatar{background:#353945;color:#e0e4ef}
[data-theme=dark] .role-pill{color:var(--accent)}
[data-theme=dark] .btn:not(.primary):not(.danger){background:var(--card2);color:var(--ink);border-color:var(--line2)}
[data-theme=dark] .btn.danger{background:#35272e;color:#ff929f;border-color:#69404a}
[data-theme=dark] input,[data-theme=dark] select,[data-theme=dark] textarea{color:var(--ink);color-scheme:dark}
[data-theme=dark] input::placeholder,[data-theme=dark] textarea::placeholder{color:#969ba8;opacity:1}
[data-theme=dark] .empty-state,[data-theme=dark] .detail-info{background:var(--card);color:var(--ink)}
[data-theme=dark] .attachment,[data-theme=dark] .file-chip{background:var(--card2);color:var(--ink)}
[data-theme=dark] .switch{background:#454955}[data-theme=dark] .switch.on{background:var(--green)}
/* Compact, readable countdown with hours only when needed. */
.school-clock.clock-v22{display:block;padding:16px 18px;border-radius:20px;border:1px solid var(--line);min-height:0;background:var(--card)}
.clock-heading{display:flex;align-items:center;gap:10px}.clock-heading>.icon-badge{width:32px;height:32px;flex-basis:32px}.clock-heading>.icon-badge svg{width:18px;height:18px}.clock-heading>span:last-child{font-size:13px;color:var(--ink2);font-weight:500}
.school-clock.clock-v22 .clock-duration{font-size:clamp(23px,6.5vw,31px);line-height:1.2;letter-spacing:-.035em;font-variant-numeric:tabular-nums;font-weight:650;margin:12px 0 8px;overflow-wrap:normal}
.school-clock.clock-v22 .clock-caption{font-size:13px;line-height:1.45;color:var(--ink2)}.clock-timezone{display:block;font-size:10px;color:var(--ink3);margin-top:12px}.clock-v22 .meal-reminder{font-size:12px;padding:10px;margin-top:12px}
.home-overview{display:grid;gap:12px;margin-bottom:16px}.home-overview .home-banner{margin:0}.home-overview #schoolClock{margin:0}
/* 4:3 cropped preview; only its explicit action opens the original. */
.news-photo.news-preview{display:block;position:relative;width:calc(100% - 24px);aspect-ratio:4/3;height:auto;max-height:none;margin:0 12px 12px;border-radius:17px;overflow:hidden;background:var(--bg2);padding:0}
.news-photo.news-preview>img{position:absolute;inset:0;display:block;width:100%;height:100%;max-height:none;object-fit:cover;object-position:center;border-radius:inherit}
.news-preview .preview-open{position:absolute;bottom:10px;right:10px;display:flex;align-items:center;gap:6px;min-height:36px;padding:8px 11px;border-radius:20px;background:#12151abb;color:#fff;font-size:12px;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid #ffffff38}.preview-open svg{width:15px;height:15px}
.article-post>.news-preview{max-width:600px;margin:16px auto;width:100%;aspect-ratio:4/3}.photo-viewer .photo-full{object-fit:contain;border-radius:0}
/* Keep form text at 16px to prevent iPhone input auto-zoom. */
.overlay .sheet{max-width:560px;border-radius:23px 23px 0 0}.sheet-header{padding:10px 16px 12px}.sheet-header h2{font-size:18px;line-height:1.2}.sheet-header .sheet-close{width:32px;height:32px;flex-basis:32px}.sheet-body{padding:14px 16px calc(16px + var(--safe-bottom));font-size:14px}.sheet .field{margin-bottom:12px}.sheet .field label{font-size:13px;line-height:1.35;margin-bottom:5px}.sheet-body .field input,.sheet-body .field select,.sheet-body .field textarea{font-size:16px;min-height:42px;padding:10px 12px;border-radius:12px}.sheet-body .field textarea{min-height:84px}.sheet-body .hint{font-size:12px;line-height:1.45;margin-bottom:12px}.sheet-body .btn{font-size:13px;min-height:40px;padding:9px 13px;border-radius:13px}.sheet-body .actions{gap:8px;padding-top:10px}.sheet-body label.check-row{font-size:14px;padding:8px 0}.sheet-body .rank-row{padding:10px;gap:10px}.sheet-body .rank-row>img{width:58px;height:58px;flex-basis:58px}
@media(min-width:900px){
 :root{--header-height:78px}
 .sidebar{display:flex;flex-direction:column;flex:0 0 216px;width:216px;padding:24px 14px 14px;background:var(--card);border-right:1px solid var(--line);overflow-y:auto}.sidebar .side-brand{padding:4px 10px 22px}.sidebar .side-brand img{width:166px}.side-nav{display:grid;gap:4px}.side-btn{min-height:43px;padding:10px 12px;font-size:13px;border-radius:12px;text-align:left;gap:10px}.side-btn svg{width:19px;height:19px}.side-btn.active{background:var(--accentSoft);color:var(--accent)}.side-foot{margin-top:auto;padding-top:20px}.nav-divider{font-size:10px;text-transform:uppercase;letter-spacing:.06em;padding:22px 12px 8px;color:var(--ink3)}
 .hd{padding:16px 28px!important;min-height:76px}.hd>.hd-brand{display:none}.desktop-route-bar{display:flex;align-items:center;gap:12px;min-width:0}.desktop-route-bar small,.desktop-route-bar b{display:block}.desktop-route-bar small{font-size:10px;color:var(--ink3);margin-bottom:4px}.desktop-route-bar b{font-size:15px;font-weight:650}.desktop-back{display:grid;place-items:center;width:34px;height:34px;border:1px solid var(--line2);border-radius:10px;background:var(--card);color:var(--ink2)}.desktop-back svg{width:18px}.desktop-back:disabled{opacity:.35;cursor:default}.hd-actions{gap:10px}.hd-btn,.hd-avatar{width:36px;height:36px}.hd-btn svg{width:19px}
 .scroll{padding:calc(var(--header-height) + 24px) 28px 40px}.app.detail-mode .hd{display:flex}.app.detail-mode .scroll{padding:calc(var(--header-height) + 24px) 28px 40px}.dock{display:none}
 #page{max-width:1320px;width:100%;margin-inline:auto}#page[data-page=home]{display:block}.page-title,.greet{margin:0 0 22px}.page-title h1,.greet h1{font-size:29px;line-height:1.16;letter-spacing:-.04em}.page-title p,.greet p{font-size:13px;margin-top:7px}
 .home-overview{grid-template-columns:minmax(0,1.6fr) minmax(260px,1fr);gap:20px;margin-bottom:22px;align-items:stretch}.home-overview .home-banner{min-height:190px;padding:26px;border-radius:22px}.home-overview .home-banner p{font-size:25px;max-width:390px;line-height:1.32}.home-overview #schoolClock{display:flex}.school-clock.clock-v22{width:100%;padding:20px}.school-clock.clock-v22 .clock-duration{font-size:29px;margin-top:19px}.home-actions{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.home-actions .nav-card{min-height:84px;padding:14px 16px;border-radius:17px}.nav-card .icon-badge{width:42px;height:42px;flex-basis:42px}.nav-card .icon-badge svg{width:22px;height:22px}.nav-card .card-copy b{font-size:16px}.nav-card .card-copy small{font-size:12px;margin-top:5px}.admin-section{margin-top:26px}.section-head h2{font-size:18px}.club-entry{margin-top:14px;max-width:calc(50% - 6px)}
 .profile-layout{grid-template-columns:minmax(300px,.85fr) minmax(340px,1.15fr);gap:24px;align-items:start}.profile-card{min-height:108px;padding:18px}.profile-name h2{font-size:22px}.profile-stats{gap:12px;margin-top:12px}.profile-links{gap:10px}.profile-secondary{margin-top:26px}.profile-secondary .home-actions{grid-template-columns:repeat(2,minmax(0,1fr))}.logout-btn{font-size:14px;padding:12px;min-height:44px;border-radius:14px}
 #page[data-page=schedule] .days{max-width:760px;gap:8px;margin:0 0 18px}.day{min-height:62px;border-radius:14px}.day .d-name{font-size:11px}.day .d-num{font-size:19px}.schedule-tools{justify-content:flex-start;overflow:visible;gap:8px}.schedule-tools>.btn{flex:0 0 auto;padding:10px 14px;font-size:12px;min-height:40px}.filters{justify-content:flex-start;margin:14px 0;gap:12px}.filters .select-field{flex-basis:250px}.lesson-list{grid-template-columns:1fr;gap:9px}.lesson{min-height:72px;padding:12px 18px;grid-template-columns:64px 4px minmax(0,1fr) 42px;gap:16px;border-radius:15px}.lesson .subject{font-size:17px}.teacher-line{font-size:13px}.time-start{font-size:15px}.time-end{font-size:12px}.lesson .icon-badge{width:42px;height:42px;flex-basis:42px}.lesson-status-row{right:78px;top:14px}.sched-table-wrap{border:1px solid var(--line2);border-radius:18px;max-height:calc(100dvh - 340px);min-height:200px}.sched-table-head{position:sticky;top:0;z-index:5;background:var(--card)}.sched-cell,.sched-table-cell-head{flex-basis:180px;width:180px}.sched-cell{padding:14px;min-height:98px;font-size:12px}.sched-cell b{font-size:14px}.sched-table-lesson{flex-basis:78px;width:78px;font-size:13px}
 .news-feed{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start}.feed-post{margin:0;border-radius:22px}.feed-byline{padding:16px}.feed-copy{padding:0 16px 14px}.feed-title h2,.feed-copy h2{font-size:21px;line-height:1.2}.feed-copy p{font-size:13px}.news-photo.news-preview{width:calc(100% - 32px);margin:0 16px 16px}.feed-post footer{padding:0 16px 16px}
 #page[data-page=article],#page[data-page=homework-detail]{max-width:860px}.article-post> .news-preview{width:100%;max-width:620px;margin-inline:auto}.article-post .page-title h1{font-size:30px}.article-body{font-size:16px;line-height:1.7}.detail-card{padding:20px}.detail-header h1{font-size:20px}.detail-task p{font-size:14px}
 #page[data-page=settings]{max-width:820px}.appearance-panel,.prof-item{max-width:none}.desktop-controls{margin-top:14px}.desktop-controls h2{font-size:17px}.desktop-controls p,.desktop-controls dl{font-size:13px;line-height:1.5;color:var(--ink2)}.desktop-controls dl{display:grid;grid-template-columns:1fr auto;gap:12px;margin-top:18px}.desktop-controls dd{margin:0}kbd{font:inherit;background:var(--bg2);border:1px solid var(--line2);border-radius:6px;padding:3px 7px;color:var(--ink)}
 .hw-group{max-width:none}.hw-group .homework-card{padding:16px}.hw-card-title h3{font-size:17px}.hw-desc{font-size:14px}.menu-panel{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.dish-card{padding:14px;border-radius:17px}.dish-body h3{font-size:16px}.menu-days{max-width:680px}.admin-row{padding:12px 16px;min-height:68px}.admin-grid,.stats-grid{gap:14px}
 .overlay{padding:24px;align-items:center}.overlay .sheet{width:min(560px,100%);max-width:560px;max-height:min(86dvh,820px);border-radius:22px}.sheet-header{padding:14px 20px}.sheet-header h2{font-size:20px}.sheet-body{padding:16px 20px 20px}.sheet-body.lesson-editor-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:14px}.lesson-editor-grid>.hint,.lesson-editor-grid>.actions,.lesson-editor-grid>.check-row,.lesson-editor-grid>.smart-suggestions{grid-column:1/-1}.lesson-editor-grid>.field:has(textarea){grid-column:1/-1}
 .photo-viewer.overlay{padding:0}.photo-viewer.overlay .sheet{max-width:none;width:100%;max-height:none;height:100dvh;border-radius:0}
}
@media(min-width:1350px){.home-actions{grid-template-columns:repeat(4,minmax(0,1fr))}.home-actions .nav-card{display:grid;grid-template-columns:42px 1fr;gap:14px;padding:18px;min-height:142px;align-content:start}.home-actions .nav-card .card-copy{grid-column:1/-1}.home-actions .nav-card>.chevron{grid-column:2;grid-row:1;justify-self:end;width:18px}.club-entry{max-width:calc(25% - 9px)}.news-feed{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(min-width:900px) and (max-width:1099px){.sidebar{width:184px;flex-basis:184px;padding-inline:10px}.scroll{padding-left:20px;padding-right:20px}.hd{padding-inline:20px!important}.home-overview{grid-template-columns:1fr}.home-overview .home-banner{min-height:150px}.profile-layout{grid-template-columns:1fr}.news-feed{grid-template-columns:1fr}.feed-post{max-width:600px;width:100%;margin-inline:auto}}

/* v26 — gesture router. Edge-back and tab swipes are mutually exclusive. */
@media(max-width:899px){
  .app,.main-col,.scroll{overscroll-behavior-x:none}
  #page{transform-origin:left center;backface-visibility:hidden;-webkit-backface-visibility:hidden}
  #page.nav-gesture-active{will-change:transform,opacity;contain:paint}
  .overlay.modal-back-dragging{will-change:opacity}
  .overlay.modal-back-dragging .sheet{will-change:transform;backface-visibility:hidden;-webkit-backface-visibility:hidden}
}
