/* CITY responsive mobile shell */
.mobile-brandbar,.mobile-bottom-nav,.mobile-more-sheet,.mobile-zoom-controls{display:none}
@media(max-width:820px){
  html,body{width:100%;max-width:100%;overflow-x:hidden}
  body{--city-mobile-nav-height:76px;--city-safe-bottom:env(safe-area-inset-bottom,0px);padding-top:54px;padding-bottom:calc(var(--city-mobile-nav-height) + var(--city-safe-bottom) + 12px);background:#fdfdfc}
  .shell{display:block;height:auto;min-height:calc(100vh - 126px);overflow:visible}
  .sidebar{display:none!important}
  main{width:100%;min-width:0;min-height:0;padding:0 8px 12px;overflow:visible}
  .mobile-brandbar{position:fixed;display:flex;left:0;right:0;top:0;height:54px;z-index:60;align-items:center;gap:9px;padding:7px 12px;background:#fff;border-bottom:1px solid #e3e6eb}
  .mobile-brandbar img{width:38px;height:38px;object-fit:contain}
  .mobile-brandbar strong{font-size:15px;color:#28354e;white-space:nowrap}
  .mobile-context{margin-left:auto;max-width:42%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:#7b8493}
  .mobile-bottom-nav{position:fixed;display:grid;left:0;right:0;bottom:0;box-sizing:border-box;height:calc(var(--city-mobile-nav-height) + var(--city-safe-bottom));z-index:65;grid-template-columns:repeat(5,minmax(0,1fr));padding:0 0 var(--city-safe-bottom);background:#fdfdfc;border-top:1px solid #dfe3e8;backdrop-filter:blur(16px)}
  .mobile-nav-item{box-sizing:border-box;display:flex!important;min-width:0!important;width:100%;height:75px!important;flex-direction:column;align-items:center;justify-content:center;gap:5px!important;margin:0!important;padding:8px 2px!important;border:0;border-radius:8px;color:#7b8593!important;background:transparent!important;font:500 10px/14px system-ui!important;text-decoration:none}
  .mobile-nav-item.active{color:#252f5e!important;background:#f0f1f6!important}
  .mobile-nav-icon-wrap{position:relative;display:flex;align-items:center;justify-content:center;width:24px;height:24px;flex:none;overflow:visible}
  .mobile-nav-item svg{display:block;width:22px!important;height:22px!important;flex:none;fill:none;stroke:currentColor;stroke-width:1.7}
  .mobile-nav-label{display:block;max-width:100%;height:14px;line-height:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .mobile-nav-badge{position:absolute;top:-6px;right:-9px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 4px;border-radius:9px;background:#ed3d4d;color:#fff;font:700 10px/18px system-ui;white-space:nowrap;pointer-events:none}
  .mobile-nav-badge[hidden]{display:none}
  .mobile-more-button svg{fill:currentColor;stroke:none}
  .mobile-brandbar a{display:flex;align-items:center}
  .mobile-more-sheet{position:fixed;display:flex;inset:0;z-index:80;align-items:flex-end;background:#1f28363d}
  .mobile-more-sheet[hidden]{display:none!important}
  .mobile-more-card{width:100%;max-height:78vh;overflow:auto;padding:12px 14px calc(18px + env(safe-area-inset-bottom));background:#fff;border-radius:18px 18px 0 0;box-shadow:0 -16px 60px #1b25352c}
  .mobile-more-head{display:flex;align-items:center;justify-content:space-between;padding:2px 4px 10px}
  .mobile-more-head b{font-size:18px}
  .mobile-more-head button{width:34px;height:34px;border:0;border-radius:50%;background:#f0f1f4;font-size:22px}
  .mobile-more-links{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .mobile-more-link{display:flex!important;align-items:center;gap:10px;padding:13px!important;border:1px solid #e2e6ec;border-radius:10px;color:#37445b!important;text-decoration:none;background:#fff!important}
  .mobile-more-link svg{width:19px;height:19px}
  .toolbar{min-height:52px;height:auto;display:flex;align-items:center;gap:7px;flex-wrap:wrap;padding:8px 0}
  .toolbar h1{min-width:0;flex:1 1 auto;font-size:21px;line-height:1.1}
  .toolbar-end{margin-left:auto;gap:6px}
  .toolbar-end .search{display:none}
  .toolbar-end .primary{height:32px;padding:0 10px;font-size:12px}
  .period-control{order:3;width:100%;justify-content:center;gap:5px}
  .period-control b{font-size:13px}
  .filterbar{display:flex;min-height:40px;align-items:center;gap:7px;overflow-x:auto;overflow-y:hidden;padding-bottom:7px;scrollbar-width:none}
  .filterbar::-webkit-scrollbar{display:none}
  .location-tabs,.teacher-filter,.view-tabs,#journal-tools,.help{flex:none}
  .view-tabs{margin-left:0}
  .teacher-filter{max-width:175px}
  .mobile-schedule-viewport{width:100%;height:calc(100vh - 220px);min-height:500px;overflow:auto;-webkit-overflow-scrolling:touch;border:1px solid #e3e6eb;border-radius:8px;background:#fff;touch-action:none}
  .mobile-schedule-viewport[hidden]{display:none!important}
  .zoom-sizer{position:relative}
  .mobile-schedule-stage{position:absolute;left:0;top:0;width:1120px!important;height:702px!important;min-height:702px!important;display:grid!important;grid-template-columns:940px 180px!important;gap:0!important;border:0!important;border-radius:0!important;background:#fff;overflow:visible!important}
  .mobile-schedule-stage .calendar{width:940px!important;height:702px!important;min-height:702px!important;border:0!important;border-right:1px solid #dfe3e8!important;border-radius:0!important;overflow:visible!important}
  .mobile-schedule-stage .calendar-heading{width:940px!important;min-width:940px!important}
  .mobile-schedule-stage .calendar-heading>div{grid-template-columns:repeat(6,minmax(0,1fr))!important}
  .mobile-schedule-stage .calendar-scroll{width:940px!important;height:648px!important;min-height:648px!important;overflow:visible!important;flex:none!important}
  .mobile-schedule-stage .calendar-body{width:940px!important;min-width:940px!important;height:648px!important}
  .mobile-schedule-stage .days{grid-template-columns:repeat(6,minmax(0,1fr))!important}
  .mobile-schedule-stage .control{width:180px!important;height:702px!important;overflow:hidden!important;border-left:0!important;padding:0 10px!important;background:#fbfaf8!important}
  .mobile-schedule-stage .control-heading{height:54px!important;border-bottom:1px solid var(--line);padding:0 2px}
  .mobile-schedule-stage .control-heading b{font-size:18px;color:#3c4759}
  .mobile-schedule-stage .control-caption{margin-top:10px}
  .mobile-schedule-stage .notes{border-top:1px solid var(--line);margin-top:8px}
  .mobile-schedule-stage .calendar-footer{display:none!important}
  .mobile-zoom-controls{display:flex;width:max-content;align-items:center;gap:2px;margin:7px 0 10px;padding:3px;background:#fff;border:1px solid #dce1e8;border-radius:9px;box-shadow:0 4px 14px #27303d18}
  .mobile-zoom-controls button{height:31px;min-width:34px;border:0;border-radius:6px;padding:0 9px;background:#f3f5f8;color:#3e4a60;font-weight:600}
  .mobile-zoom-controls button[data-zoom="fit"]{min-width:100px}
  .mobile-zoom-controls .zoom-value{min-width:44px;text-align:center;font-size:11px;color:#6f7988}
  #journal{width:100%;min-width:0}
  .journal-status{overflow-x:auto;white-space:nowrap;gap:12px;scrollbar-width:none}
  .journal-status::-webkit-scrollbar{display:none}
  .journal-status-end{margin-left:0}
  .journal-scroll{width:100%;overflow:auto;-webkit-overflow-scrolling:touch;touch-action:none}
  .journal-zoom-sizer{position:relative}
  .journal-zoom-sizer #month-table{position:absolute;left:0;top:0;width:1584px!important;min-width:1584px!important;transform-origin:0 0}
  .drawer{width:100vw;max-width:100vw;padding:18px}
  .people-workspace,.team-page,.daily-page{width:100%;max-width:100%;padding:14px 8px 36px;overflow-x:hidden}
  .people-columns,.daily-columns{grid-template-columns:1fr}
  .team-page form{grid-template-columns:1fr}
  body.no-finance .balance-cell,body.no-finance .package-cell,body.no-finance th.sticky2,body.no-finance th.sticky3{display:none!important}
}

/* Sunday is the seventh weekly control column on desktop */
@media(min-width:821px){
  .schedule-layout{grid-template-columns:minmax(0,6fr) minmax(145px,1fr);gap:0;border:1px solid #e5e5e3;border-radius:7px;overflow:hidden;background:#fff}
  .calendar{border:0;border-radius:0}
  .control{border-left:1px solid #dfe3e8;padding:0 10px;background:#fbfaf8}
  .control-heading{height:54px;border-bottom:1px solid var(--line);padding:0 2px}
  .control-heading b{font-size:18px;color:#3c4759}
  .control-caption{margin-top:10px}
  .notes{border-top:1px solid var(--line);margin-top:8px}
}
/* CITY schedule density + role privacy */
html[data-role="teacher"] .balance-cell,
html[data-role="teacher"] .package-cell,
html[data-role="teacher"] #month-table .sticky2,
html[data-role="teacher"] #month-table .sticky3,
html[data-role="teacher"] [data-review="attention"],
html[data-role="teacher"] [data-review="prepaid"],
html[data-role="methodist"] .balance-cell,
html[data-role="methodist"] .package-cell,
html[data-role="methodist"] #month-table .sticky2,
html[data-role="methodist"] #month-table .sticky3,
html[data-role="methodist"] [data-review="attention"],
html[data-role="methodist"] [data-review="prepaid"]{display:none!important}

.calendar-body{height:648px!important}
.day{height:648px!important;background-image:repeating-linear-gradient(to bottom,transparent 0,transparent 53px,#cbd1da 53px,#cbd1da 54px)!important}
.time{height:54px!important;padding-top:2px!important;font-size:10px!important}
.calendar-scroll{scrollbar-width:none}
.calendar .lesson{padding:3px 5px!important}
.calendar .lesson .lesson-meta{font-size:9px!important;line-height:11px!important}
.calendar .lesson .lesson-title{font-size:11px!important;line-height:13px!important;margin-top:1px!important}
.calendar .lesson .lesson-context{font-size:9px!important;line-height:11px!important;margin:0!important}
.calendar .lesson .lesson-foot{display:none!important}
@media(min-width:821px){
  .shell{height:100vh}
  main{padding-bottom:6px}
  .toolbar{height:54px;min-height:54px}
  .filterbar{min-height:38px}
  .schedule-layout{min-height:0;flex:1}
  .calendar-heading{height:42px;min-height:42px}
  .control-heading{height:42px!important}
  .calendar-scroll{overflow:hidden!important}
  .calendar-footer{height:24px;min-height:24px}
}

.time-axis::after{content:"21:00";position:absolute;left:0;right:7px;bottom:-6px;text-align:right;font-size:10px;color:#727d8c}
@media(min-width:821px){
  .calendar{height:714px!important;min-height:714px!important;align-self:start!important}
  .control{height:714px!important;max-height:714px!important;align-self:start!important}
  .schedule-layout{align-items:start!important}
}

/* The full 09:00–21:00 axis is the canvas height, including after fit-width. */
.calendar-body, .day { height: calc(var(--city-hour-px, 54px) * 12) !important; }
.time { height: var(--city-hour-px, 54px) !important; }
.day {
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--city-hour-px, 54px) - 1px), #cbd1da calc(var(--city-hour-px, 54px) - 1px), #cbd1da var(--city-hour-px, 54px)) !important;
}
@media(min-width:821px) {
  .sidebar { width: 164px; padding-inline: 8px; }
  .shell { grid-template-columns: 164px minmax(0, 1fr); }
  .schedule-layout { height: 100%; min-height: 0; grid-template-columns: minmax(0, 6fr) minmax(150px, 1fr); }
  .calendar, .control { height: 100% !important; max-height: none !important; align-self: stretch !important; }
  .calendar-scroll { overflow-y: auto !important; }
  .calendar .lesson .lesson-title { font-size: 13px !important; line-height: 16px !important; overflow: hidden; text-overflow: ellipsis; }
  .calendar .lesson .lesson-meta { font-size: 11px !important; line-height: 14px !important; }
  .calendar .lesson .lesson-context { font-size: 11px !important; line-height: 14px !important; }
}
@media(max-width:820px) {
  .mobile-schedule-stage, .mobile-schedule-stage .calendar, .mobile-schedule-stage .control {
    height: calc(var(--city-hour-px, 150px) * 12 + 54px) !important;
    min-height: calc(var(--city-hour-px, 150px) * 12 + 54px) !important;
  }
  .mobile-schedule-stage .calendar-scroll, .mobile-schedule-stage .calendar-body, .mobile-schedule-stage .day {
    height: calc(var(--city-hour-px, 150px) * 12) !important;
    min-height: calc(var(--city-hour-px, 150px) * 12) !important;
  }
  .mobile-schedule-viewport { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .mobile-schedule-stage .control { overflow: auto !important; }
}

@media(max-width:820px) {
  .mobile-schedule-stage .lesson .lesson-title {
    font-size: clamp(11px, calc(10px / var(--city-scale, 1)), 29px) !important;
    line-height: 1.08 !important;
    white-space: normal;
    overflow: hidden;
  }
  .mobile-schedule-stage .lesson .lesson-meta,
  .mobile-schedule-stage .lesson .lesson-context {
    font-size: clamp(9px, calc(8px / var(--city-scale, 1)), 23px) !important;
    line-height: 1.1 !important;
    white-space: normal;
  }
}

/* Operational colors come from the canonical schedule projection. */
.lesson.tone-light-blue { background:#f3f6fa; border-left-color:#a8bcd8; }
.lesson.tone-pink { background:#faeff3; border-left-color:#d1a8b8; }
.lesson.tone-yellow { background:#fdfaf1; border-left-color:#d9bd76; }
.lesson.tone-green { background:#f4f9f6; border-left-color:#99baa9; }
.lesson.tone-purple { background:#f7f5fb; border-left-color:#b3a6ca; }
.lesson.tone-red { background:#fcf8f7; border-left-color:#cfaaa3; }
.lesson.tone-orange { background:#fcf5eb; border-left-color:#d2b18e; }

/* Keep every participant and mark in the actual card. The week scrolls vertically. */
.calendar .lesson .participants{display:block!important;min-height:0;overflow:visible!important}
.calendar .lesson .person{height:auto;min-height:18px;gap:3px}
.calendar .lesson .person-name{min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:clamp(10px,.76vw,13px);line-height:17px}
.calendar .lesson .participant-state{flex:none}
.calendar .lesson .participant-number{flex:none;font-size:10px}
.calendar .lesson.busy{z-index:3}
@media(min-width:821px){
 .calendar .lesson.busy{min-height:168px;overflow:visible}
 .calendar-scroll{scrollbar-width:thin}
}
@media(max-width:820px){
 .mobile-schedule-stage .lesson.busy{min-height:170px;overflow:visible}
 .mobile-schedule-stage .lesson .person-name{font-size:clamp(11px,calc(9px / var(--city-scale, 1)),23px);line-height:1.15}
}
#month-table.no-finance .sticky4{left:190px}
#month-table.no-finance .sticky2,#month-table.no-finance .sticky3,
#month-table.no-finance .balance-cell,#month-table.no-finance .package-cell{display:none!important}
#month-table.no-finance col.finance-col{display:none}
#month-table .makeup-cell{position:sticky;background:#fff;overflow:hidden}
#month-table .makeup-cell button{max-width:100%;overflow:hidden}
#month-table .month-date{min-width:34px}
.notes button[data-week-note]{display:block;width:100%;text-align:left;padding:5px 0;color:#516784}
.notes #week-note{white-space:pre-wrap;word-break:break-word}

/* Task detail stays tappable above mobile shell; existing pastel surfaces retained. */
@media(max-width:820px){.daily-detail{z-index:75;inset:0;width:100%;max-width:100%;height:100vh;height:100dvh;box-sizing:border-box;padding:calc(14px + env(safe-area-inset-top,0px)) 16px calc(24px + env(safe-area-inset-bottom,0px));overscroll-behavior:contain;-webkit-overflow-scrolling:touch}.daily-detail #close-task{float:none;position:sticky;top:0;z-index:1;min-height:44px;min-width:44px;margin-bottom:12px;background:#fafbff}.daily-detail .daily-actions a{min-height:44px;display:inline-flex;align-items:center;padding:4px 8px}.daily-task{position:relative;padding-right:30px;min-height:44px}.daily-task::after{content:'›';position:absolute;right:8px;top:12px;font-size:24px;color:#69768b}.daily-link-unavailable{font-size:13px;line-height:1.5;color:#69768b;overflow-wrap:anywhere}}

@media(max-width:820px){.task-list-view .daily-task-section{order:-1}}
