/* Leelas on a phone: the approved rules (Asa, 28 Sep 2026, "go" on https://claude.ai/artifact/LQ9aHiZvRFhoWU9NdVoxV1).
   Schools and Settings only; the nursery pages keep their own phone rules. phone.js marks the elements, this file
   draws them, and nothing here applies above 760px, so desktop does not change. Nothing is removed: tabs collapse into
   a button, filters into a sheet, table columns into a card's "more". */
@media (max-width:760px){

/* ── rule 3: tabs inside a page — three or fewer a switch, more a button and a list ─────────────────────────── */
.ph-seg{display:flex!important;flex-wrap:nowrap!important;overflow:visible!important;background:#F3EEE8;border-radius:12px;padding:3px;gap:0!important;border:0!important}
.ph-seg>button{flex:1 1 0!important;min-width:0;min-height:40px;border:0!important;background:none!important;border-radius:9px!important;box-shadow:none!important;
  color:#675E54!important;font-weight:600;font-size:13px!important;padding:6px 4px!important;white-space:normal!important;line-height:1.2}
.ph-seg>button.on,.ph-seg>button.active,.ph-seg>button[aria-selected="true"]{background:#fff!important;color:#16130F!important;box-shadow:0 1px 3px rgba(0,0,0,.12)!important}
.ph-collapsed{display:none!important}
.ph-pick{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:46px;margin:6px 0 10px;padding:0 14px;
  border:1px solid #E1DCD7;border-radius:12px;background:#fff;color:#16130F;font:inherit;font-size:14.5px;font-weight:600;cursor:pointer;text-align:left}
.ph-pick small{color:#675E54;font-weight:500;font-size:12.5px;flex:none}
#schnav3+.ph-pick,.ph-pick.ph-pick-grp{margin:8px var(--gutter,16px) 4px;width:calc(100% - 2 * var(--gutter,16px))}

/* the sheet every list, filter and choice opens in */
.ph-shade{position:fixed;inset:0;background:rgba(20,17,14,.42);z-index:180}
.ph-sheet{position:fixed;left:0;right:0;bottom:0;z-index:181;background:#fff;border-radius:22px 22px 0 0;max-height:82vh;overflow-y:auto;
  padding:10px 16px calc(18px + env(safe-area-inset-bottom,0px));box-shadow:0 -10px 30px rgba(0,0,0,.18)}
.ph-sheet .ph-grip{width:40px;height:4px;border-radius:4px;background:#E1DCD7;margin:0 auto 12px}
.ph-sheet h3{margin:0 0 6px;font-family:Nunito,ui-rounded,-apple-system,sans-serif;font-size:16px;font-weight:700}
.ph-sheet .ph-opt{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:48px;border:0;border-top:1px solid #F3EEE8;
  background:none;padding:0 2px;font:inherit;font-size:15px;color:#16130F;cursor:pointer;text-align:left}
.ph-sheet .ph-opt.on{color:#1D7A5A;font-weight:600}

/* ── rule 4: a deeper level is its own screen, with a back arrow (Settings) ─────────────────────────────────────── */
.ph-stackrow{display:none!important}
.ph-home~*:not(.ph-stacklist){display:none!important}
.ph-stacklist{background:#fff;border:1px solid #E1DCD7;border-radius:16px;padding:2px 14px;margin:6px 0 12px}
.ph-stacklist button{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:54px;border:0;border-top:1px solid #F3EEE8;
  background:none;padding:0;font:inherit;font-size:15px;color:#16130F;cursor:pointer;text-align:left}
.ph-stacklist button:first-child{border-top:0}
.ph-stacklist button::after{content:"›";color:#675E54;font-size:18px}
.ph-back{display:inline-flex;align-items:center;gap:4px;border:0;background:none;color:#1D7A5A;font:inherit;font-size:14.5px;font-weight:600;padding:8px 0;margin:0 0 4px;cursor:pointer}

/* ── rule 5: filters — one button with a count, a sheet, and chips for what is on ─────────────────────────────── */
.ph-fbar{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:0 0 10px}
.ph-fbtn{display:inline-flex;align-items:center;gap:8px;min-height:40px;padding:0 14px;border:1px solid #E1DCD7;border-radius:999px;background:#fff;
  color:#16130F;font:inherit;font-size:13px;font-weight:600;cursor:pointer}
.ph-fbtn b{background:#1D7A5A;color:#fff;border-radius:999px;font-size:11px;padding:1px 7px}
.ph-chip{display:inline-flex;align-items:center;gap:6px;max-width:100%;font-size:12px;font-weight:600;border-radius:999px;padding:5px 10px;background:#E1F5EE;color:#1D7A5A}
.ph-chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ph-chip button{border:0;background:none;color:inherit;font:inherit;padding:0 0 0 2px;cursor:pointer}
.ph-fwrap{flex-wrap:wrap!important;overflow:visible!important;gap:8px 10px!important;align-items:flex-end!important}
.ph-fwrap>*{flex:1 1 140px!important;min-width:0!important}
.ph-fwrap>button{flex:0 0 auto!important;min-height:40px}
.ph-fwrap input,.ph-fwrap select,.ph-fwrap .schpick-b{width:100%!important;min-height:40px}
.ph-filters:not(.ph-open){display:none!important}
.ph-filters.ph-open{display:flex!important;flex-direction:column!important;align-items:stretch!important;flex-wrap:nowrap!important;gap:10px!important;
  position:fixed;left:0;right:0;bottom:0;z-index:181;margin:0!important;background:#fff!important;border:0!important;border-radius:22px 22px 0 0;
  max-height:82vh;overflow-y:auto!important;overflow-x:hidden!important;padding:18px 16px calc(18px + env(safe-area-inset-bottom,0px))!important;
  box-shadow:0 0 0 100vmax rgba(20,17,14,.42),0 -10px 30px rgba(0,0,0,.18)}
.ph-filters.ph-open>*{flex:0 0 auto!important;width:100%!important;max-width:none!important;min-width:0!important}
.ph-filters.ph-open .fg{display:grid;gap:4px}
.ph-filters.ph-open select,.ph-filters.ph-open input:not([type=checkbox]):not([type=radio]){width:100%!important;min-height:44px;font-size:15px}
.ph-filters.ph-open .ph-done{min-height:46px;border-radius:12px;border:0;background:#1D7A5A;color:#fff;font:inherit;font-size:14px;font-weight:600;cursor:pointer}

/* ── rule 6: a list table becomes cards; a true grid keeps scrolling with its first column held ──────────────── */
main table.ph-cards,table.ph-cards{display:block!important;overflow:visible!important;width:100%!important;border:0!important;background:none!important;min-width:0!important}
table.ph-cards thead{display:none!important}
table.ph-cards tbody,table.ph-cards tfoot{display:block!important}
table.ph-cards tr{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px;background:#fff;border:1px solid #E1DCD7;border-radius:14px;padding:11px 12px;margin:0 0 8px}
table.ph-cards td,table.ph-cards th{display:block!important;border:0!important;padding:0!important;white-space:normal!important;text-align:left!important;min-width:0;width:auto!important;max-width:none!important;font-variant-numeric:tabular-nums}
table.ph-cards td::before{content:attr(data-l);display:block;font-size:9.5px;font-weight:600;letter-spacing:.07em;text-transform:uppercase;color:#8A8274;margin-bottom:1px}
table.ph-cards td[data-l=""]::before{display:none}
table.ph-cards td:first-child{grid-column:1/-1;font-size:14.5px;font-weight:600}
table.ph-cards td:first-child::before{display:none}
table.ph-cards tr.ph-band{display:block!important;background:none;border:0;padding:12px 2px 4px;margin:0}
table.ph-cards tr.ph-band td{font-weight:700}
table.ph-cards tr.ph-many:not(.ph-more) td.ph-extra{display:none!important}
table.ph-cards td.ph-morecell{grid-column:1/-1}
table.ph-cards td.ph-morecell button{border:0;background:none;color:#1D7A5A;font:inherit;font-size:12.5px;font-weight:600;padding:2px 0;cursor:pointer}
table.ph-cards tr:empty{display:none!important}
table.ph-grid th:first-child,table.ph-grid td:first-child{position:sticky;left:0;z-index:1;background:#fff;box-shadow:1px 0 0 #E1DCD7}

/* the app's own pop-over lists (the school picker, a column's filter) open as a sheet above everything on a phone */
.cfp{position:fixed!important;left:0!important;right:0!important;top:auto!important;bottom:0!important;width:auto!important;max-width:none!important;
  max-height:72vh!important;overflow-y:auto!important;z-index:190!important;border-radius:22px 22px 0 0!important;padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))!important;
  box-shadow:0 -10px 30px rgba(0,0,0,.22)!important}

/* ── rule 7: every drawer opens full screen ───────────────────────────────────────────────────────────────────── */
.schd,.kdb-drawer,.por-drawer,.sticker-drawer,.lille-panel,.chatw{width:100vw!important;max-width:100vw!important;left:0!important;right:0!important;border-radius:0!important}
.sticker-drawer,.lille-panel,.chatw{top:0!important;bottom:0!important;height:100%!important;max-height:none!important}
}
/* ── rule 9: Digest on a phone — the side rail becomes a bottom tab bar, and a list with its detail stacks ─────
   (Digest draws straight onto the page, not in a shadow root, so these reach it from here) */
@media (max-width:760px){
  .dg-app{flex-direction:column}
  .dg-rail{display:contents}
  .dg-rail-brand{order:0;padding:10px 14px}
  .dg-rail-foot{order:1;padding:8px 14px;background:#e4f3eb;border-top:0;border-bottom:1px solid #c6e8d4}
  .dg-main{order:2;flex:1;min-height:0}
  .dg-nav{order:3;flex:none;flex-direction:row;padding:0;overflow-x:auto;scrollbar-width:none;background:#fff;border-top:1px solid #c6e8d4;
    padding-bottom:env(safe-area-inset-bottom,0px)}
  .dg-nav::-webkit-scrollbar{display:none}
  .dg-ni,.dg-ni.dg-ni-sub{flex:1 0 auto;flex-direction:column;justify-content:center;gap:2px;min-height:56px;padding:6px 12px!important;margin:0!important;
    border-radius:0!important;font-size:11px;text-align:center;white-space:nowrap}
  .dg-ni.active{background:#f2faf6!important}
  .dg-db-body,.dg-bd-body,.dg-resp-wrap{flex-direction:column;overflow-y:auto;height:auto}
  .dg-db-wrap{height:auto;overflow:visible}
  .dg-db-list,.dg-bd-list,.dg-resp-sidebar{width:auto!important;flex:none;max-height:none;overflow:visible;border-right:0}
  .dg-db-panel{border-left:0;border-top:0.5px solid #c6e8d4;overflow:visible}
  .dg-kpi-row{grid-template-columns:repeat(2,minmax(0,1fr))}
  .dg-main table{display:block;overflow-x:auto}
}
/* widened back past 760px: the few parts phone.js added stand down */
@media (min-width:761px){.ph-stacklist,.ph-back,.ph-pick,.ph-fbar,td.ph-morecell,.ph-done{display:none!important}}
