/* WI-VET-031 Gate B (B1 + B2): mobile accessibility, touch ergonomics and the manager narrow-screen model.
   Loaded LAST so it can refine the shared styles. Everything here is scoped to phones - (max-width:767px) and landscape touch phones (max-height:500px) - so tablet (>=768px) and desktop layouts are unchanged. No data, auth or API behaviour is touched. */

/* ---------- B1 - employee shell (phones) ---------- */
@media (max-width:767px), (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  /* contrast: avatar initials were white on bright green (2.25:1) */
  .emp-top .emp-avatar{color:#04281f!important}
  /* text size floor 12px and readable greys (eyebrow 4.2:1, green crumb 3.9:1 before) */
  .emp-eyebrow{font-size:12px;color:#4a5c54}.emp-eyebrow b,.emp-eyebrow span{color:#00703a}
  .emp-badge,.emp-main em,.emp-chip,.emp-sr{font-size:12px}
  .cm-state b{color:#33453f}
  /* Inbox: 44px search, buttons, filter chips and Unread toggle */
  .cm-search{min-height:44px}.cm-search input{min-height:42px;font-size:16px}
  .cm-btn,.cm-tabs button{min-height:44px}
  .cm-tabs{gap:8px}
  .cm-unread{min-height:44px;padding:0 6px;font-size:14px;gap:8px}
  .cm-unread input,.cm-check input{width:24px;height:24px;margin:0}
  .cm-check{min-height:44px;align-items:center}
  /* Inbox tab unread badge (set by mobile.js from the bell's own unread count) */
  .emp-tabs button{position:relative}
  .emp-tabs button[data-badge]::after{content:attr(data-badge);position:absolute;top:4px;left:calc(50% + 6px);min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:#b3261e;color:#fff;font-size:12px;font-weight:700;line-height:18px;text-align:center}
}
/* month calendar: seven 44px-wide cells on the narrowest phones by letting the grid use the full screen width */
@media (max-width:399px){
  .emp-cal{border-spacing:0;margin-inline:-16px;width:calc(100% + 32px)}
  .emp-cell{border-radius:6px;padding:3px}
  .emp-cell .c-t{font-size:12px}
}

/* ---------- B2 - manager shell ---------- */
/* the More button and sheet exist only for the phone model below */
#nav .mnav-more{display:none}
@media (max-width:767px), (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  .app{display:block;min-height:100vh;min-height:100dvh}
  /* the left rail becomes a labelled bottom bar: four primary sections + More */
  .sidebar{position:fixed;left:0;right:0;bottom:0;top:auto;width:100%;height:auto;align-self:auto;padding:0 0 env(safe-area-inset-bottom);flex-direction:row;overflow:visible;z-index:60;background:#173C32;box-shadow:0 -2px 14px #0000003d}
  .sidebar-scroll{flex:1 1 auto;padding:0;overflow:visible;width:100%}
  .sidebar .brand,.sidebar .practice,.sidebar .nav-label,.sidebar-bottom{display:none!important}
  #nav{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:0;margin:0;padding:0}
  #nav button{flex-direction:column;justify-content:center;align-items:center;gap:2px;min-height:60px;width:100%;margin:0;padding:6px 2px 5px;border-radius:0;border-left:0;border-top:3px solid transparent;text-align:center;font-size:12px}
  #nav button.active{border-left:0;border-top-color:#79BD79}
  #nav button .nav-icon{width:22px;height:22px;flex:none}
  #nav button span{display:none!important}
  #nav button[data-short]::after{content:attr(data-short);font-size:12px;font-weight:650;line-height:1.2;white-space:nowrap;color:inherit}
  #nav .mnav-secondary{display:none!important}
  #nav .mnav-more{display:flex;color:inherit;background:transparent;border:0;border-top:3px solid transparent;font:inherit;cursor:pointer}
  #nav .mnav-more.active{border-top-color:#79BD79;background:#315C4B}
  .main{padding:12px 12px calc(84px + env(safe-area-inset-bottom));max-width:none}
  /* one-row header: brand, bell, help, time, profile - the title block follows */
  .main header{flex-direction:column;flex-wrap:nowrap;align-items:stretch;gap:8px;margin-bottom:14px}
  .main header .header-right{order:-1;width:100%;max-width:100%;flex-wrap:nowrap;justify-content:flex-end;gap:8px}
  .main header .header-right::before{content:"\271A  VetRota";margin-right:auto;font-weight:800;font-size:16px;color:#112d29;white-space:nowrap}
  .main header h1{font-size:24px;line-height:1.15}
  .help-btn{min-width:44px;min-height:44px;padding:0;justify-content:center}
  .help-btn span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  .clock{min-height:44px;min-width:0;padding:4px 10px;justify-items:center}
  .clock-date,.clock-zone{display:none}
  .user{width:44px;height:44px}
  .cm-bell{width:44px;height:44px}
  .practice-scope{display:none}
  .profile-menu{right:0;max-width:calc(100vw - 24px)}
  /* popovers anchored in the header would run off the left edge; pin them to the screen instead */
  .main .cm-bell-pop,.main .clock-pop{position:fixed;left:12px;right:12px;top:68px;width:auto;max-width:none;z-index:70}
}
@media (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  #nav button{flex-direction:row;gap:8px;min-height:48px;padding:4px 2px}
  .main{padding-bottom:calc(64px + env(safe-area-inset-bottom))}
}

/* "More" sheet */
.mnav-sheet{position:fixed;inset:0;z-index:80;display:flex;align-items:flex-end;background:#0a1f1a99}
.mnav-sheet[hidden]{display:none}
.mnav-panel{width:100%;max-height:85vh;max-height:85dvh;overflow:auto;background:#fff;color:#17342e;border-radius:18px 18px 0 0;padding:10px 12px calc(14px + env(safe-area-inset-bottom));box-shadow:0 -8px 28px #0000004d}
.mnav-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 4px 8px}
.mnav-head h2{margin:0;font-size:18px}
.mnav-close{min-width:44px;min-height:44px;border:1px solid #cbd9d3;border-radius:12px;background:#fff;font-size:18px;cursor:pointer}
.mnav-list{display:grid;gap:6px;margin:0;padding:0;list-style:none}
.mnav-list button{display:flex;align-items:center;gap:12px;width:100%;min-height:52px;padding:8px 12px;border:1px solid #dbe6df;border-radius:12px;background:#f7faf8;color:#17342e;font:inherit;font-size:16px;font-weight:600;text-align:left;cursor:pointer}
.mnav-list button.active{background:#e3f1e8;border-color:#00793d}
.mnav-list button .nav-icon{width:22px;height:22px;flex:none}
.mnav-list .mnav-out{margin-top:6px;border-color:#c9a7a3;color:#7a1f18;background:#fff}
@media (min-width:768px) and (min-height:501px){.mnav-sheet{display:none!important}}

/* ---------- B1 - manager readability and touch targets (phones) ---------- */
@media (max-width:767px), (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  /* text floor 12px */
  .eyebrow,#crumb,.stat-label,.stat-foot,.wg-head,.shift-time,.shift-len,.shift-add,.role-chip,.id-avatar,.src-tag,.notice,footer,.pill,small,.main th,.ctx-k,.main dt,.src,.effective-note,.oh-chip,.oh-none,.hint,.admin-nav button,.cov-label{font-size:12px!important}
  /* contrast */
  .eyebrow,#subtitle,.stat-label,.main th,.ctx-k,.main dt,.hint,.oh-none,.main small{color:#4f626d}
  #crumb,.stat-foot,.pill.green{color:#00703a}
  footer{color:#5b6c74}
  .wg-head{color:#46604f}.shift-add{color:#566a5e}
  .pill.amber{color:#7a5210}
  .button.primary,.admin-nav button.active{background:#00793d;border-color:#00793d;color:#fff}
  /* touch targets */
  .main .button,.main button.button,.main select,.main input:not([type=checkbox]):not([type=radio]):not([type=hidden]),.main textarea,.admin-nav button{min-height:44px}
  .tip-i{width:24px;height:24px;font-size:12px}
  /* the Overview week grid keeps its seven columns but says so, and the name column stays in view while scrolling */
  .weekly-grid-scroll{position:relative}
  .weekly-grid-scroll::before{content:"Swipe sideways to see the whole week";display:block;position:sticky;left:0;padding:0 0 6px;font-size:12px;color:#4f626d}
  .weekly-grid .wg-person{position:sticky;left:0;z-index:1;background:#fff}
  .weekly-grid .wg-head.wg-person{background:#f3f7f4}
}

/* ---------- Gate B iteration: remaining measured items ---------- */
@media (max-width:767px), (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  .emp-main em,.emp-root em,.emp-cal th span,.emp-cell .c-s{font-size:12px!important}
  .cm-search{min-height:46px}.cm-search input{min-height:44px}
  .cm-tabs button{min-width:44px}
  .cm-bell-wrap .cm-btn,.cm-bell-pop .cm-btn{min-height:44px}
  .main div:not([class])>p:not([class]),.main .acc-title,.main .acc-title p,.main label.fld>span,.main .seg button{font-size:12px}
  .main div:not([class])>p:not([class]),.main .acc-title p{color:#4f626d}
  .pill:not([class*=" "]){color:#176b3d}
  .seg button.active{background:#00793d;border-color:#00793d;color:#fff}
  .main .button,.main button.button,.access-chip,.seg button,.admin-nav button,.weekly-grid .shift,.main .shift.off,.pill[tabindex]{min-height:44px!important}
  .main .button[aria-label*="week"],.main button.button{min-width:44px}
  .pill[tabindex]{display:inline-flex;align-items:center}
  .main .button.primary,.main .button{touch-action:manipulation}
  .clock{padding-left:24px}
  #nav .mnav-more{line-height:1.2;align-items:center}
  .main header .header-right>*{flex:none}
}
@media (max-width:359px){
  .main header .header-right::before{content:"\271A";font-size:20px}
  .main header .header-right{gap:6px}
  .clock{padding:4px 6px 4px 20px}
}
@media (max-width:767px), (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  /* 12px shift times need wider day columns than the desktop 83px; the grid scrolls sideways inside its card */
  .weekly-grid{grid-template-columns:minmax(150px,1.6fr) repeat(7,minmax(108px,1fr));min-width:910px}
  .weekly-grid .shift{overflow:hidden}
}
@media (max-width:767px), (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  .oh-head{min-height:44px!important}.oh-act{font-size:12px!important}
}

/* ---------- Gate C refinements (C-R1 / C-R2) ---------- */
/* C-R1 - demo Rota Planner: day cards on phones (same model as the live rota); the seven-column grid stays from 768px up */
.wg-days{display:none}
@media (max-width:767px), (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  .weekly-grid-scroll.has-day-cards{display:none}
  .wg-days{display:grid;gap:10px}
  .wd-day{border:1px solid #DFE8E1;border-radius:10px;padding:8px;background:#fff;min-width:0}
  .wd-day h3{margin:0 0 6px;font-size:15px;color:#17342e}.wd-day h3 small{color:#4f626d;font-weight:500;font-size:12px}
  .wd-shift{display:grid;gap:2px;width:100%;min-height:44px;margin:0 0 8px;padding:8px 10px;text-align:left;font:inherit;color:#17342e;border:1px solid #DFE8E1;border-left:4px solid var(--role,#398C53);border-radius:8px;background:#F8F9F6;cursor:pointer;overflow-wrap:anywhere}
  .wd-shift.off{border-left-color:#c6d0c9;background:#fff;grid-template-columns:1fr auto;align-items:center}
  .wd-who{font-size:15px;font-weight:600}
  .wd-time{font-size:17px;font-weight:700}
  .wd-meta{font-size:13px;color:#4f626d}
  .wd-add{font-size:13px;color:#566a5e}
  .wd-open{border:1px solid #DFE8E1;border-left:4px solid #b26a00;border-radius:8px;padding:8px 10px;margin:0 0 8px;background:#fff8ea;display:grid;gap:2px}
  .wd-shift:focus-visible{outline:3px solid #0b57d0;outline-offset:2px}
}

/* C-R2 - tablet widths (768-1024): the 12px text floor and the readable greys from the phone block also apply here */
@media (min-width:768px) and (max-width:1024px) and (min-height:501px) {
  .eyebrow,#crumb,.stat-label,.stat-foot,.wg-head,.shift-time,.shift-len,.shift-add,.role-chip,.src-tag,.pill,small,.main th,.ctx-k,.main dt,.src,.effective-note,.hint,.cov-label,.nav-label,.clock-zone,.clock-date,footer,.emp-eyebrow,.emp-badge,.emp-main em,.avatar,.id-avatar,.practice-scope,.local-pill,.notice,.notice b,.notice strong,.oidc-status strong,.practice strong,.coverage-explainer strong,.role-breakdown>strong,.open-list>strong,.main p,.pill{font-size:12px!important}
  .pill:not([class*=" "]){color:#176b3d}
  .eyebrow,#subtitle,.stat-label,.main th,.ctx-k,.main dt,.hint,.oh-none,.main small,.main p:not([class]),.shift-add,.wg-head,.wg-who small{color:#4f626d}
  #crumb,.stat-foot,.pill.green{color:#00703a}
  footer{color:#5b6c74}
  .pill.amber{color:#7a5210}
  .button.primary{background:#00793d;border-color:#00793d;color:#fff}
  .emp-eyebrow{color:#4a5c54}.emp-eyebrow b,.emp-eyebrow span{color:#00703a}
  .emp-top .emp-avatar{color:#04281f!important}
  .cm-state b{color:#33453f}
  .help-btn,.cm-bell,.user,.emp-bell,.emp-avatar{min-width:44px;min-height:44px}
  /* 12px shift times need the wider day columns the phone grid uses; the grid scrolls inside its card */
  .weekly-grid{grid-template-columns:minmax(150px,1.6fr) repeat(7,minmax(108px,1fr));min-width:910px}
  .weekly-grid .shift{overflow:hidden}
  /* 'Single Practice' cannot fit the sidebar card at 12px; the practice name and region are already shown beside it */
  .practice-scope{display:none}
}
/* demo planner previous/next buttons were 28px wide on phones */
@media (max-width:767px), (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  .work-tools .nav-tools .button{min-width:44px;min-height:44px}
}

/* ---------- Gate C refinements round 2 (C-R4 .. C-R9) ---------- */
.dn-short{display:none}
/* C-R4/C-R5: compact manager header on phones. Brand + bell + help + clock + profile stay in one 44px row; the breadcrumb and subtitle (repeating the page title and the bottom bar) are visually dropped but stay in the DOM */
@media (max-width:767px), (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  .main header .eyebrow,.main header #subtitle{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  .main header{gap:2px;margin-bottom:10px}
  .main header h1{font-size:22px;margin:0}
  /* the planner panel repeats the page title: keep it for assistive tech only (the page h1 is the visible heading) */
  .planner-panel>.panel-header>div:first-child{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  .planner-panel>.panel-header{margin-bottom:6px}
  /* C-R3: shorter demonstration notice, still dashed and labelled Demonstration, so fictional data stays distinct */
  .rota-demo-note{padding:8px 12px;margin:0 0 10px;line-height:1.35;font-size:14px}
  .rota-demo-note .dn-long{display:none}.rota-demo-note .dn-short{display:inline}
  /* live rota Revisions/Leave: now folded disclosures on phones (Gate C3 block at the end of this file) */
  /* C-R6: demo planner controls in two tidy rows - [ ‹  Today  › ] then [ date | Weekly ] */
  .planner-panel .work-tools{display:grid;grid-template-columns:1fr 1fr;gap:8px;width:100%}
  .planner-panel .work-tools .nav-tools{grid-column:1/-1;display:grid;grid-template-columns:44px 1fr 44px;gap:8px}
  .planner-panel .work-tools .nav-tools .button{width:100%;min-width:0}
  .planner-panel .work-tools input,.planner-panel .work-tools select{width:100%;min-width:0}
  /* C-R9: focus and scroll-into-view never land behind the fixed bottom bar */
  html{scroll-padding-bottom:96px}
}
/* C-R7: 768-1024 manager Rota Planner uses the day cards, two or three across, instead of a grid that scrolls sideways; desktop seven-day grid (>1024) is unchanged */
@media (min-width:768px) and (max-width:1024px) and (min-height:501px){
  .weekly-grid-scroll.has-day-cards{display:none}
  .wg-days{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px}
  .wd-day{border:1px solid #DFE8E1;border-radius:10px;padding:10px;background:#fff;min-width:0}
  .wd-day h3{margin:0 0 6px;font-size:15px;color:#17342e}.wd-day h3 small{color:#4f626d;font-weight:500;font-size:12px}
  .wd-shift{display:grid;gap:2px;width:100%;min-height:44px;margin:0 0 8px;padding:8px 10px;text-align:left;font:inherit;color:#17342e;border:1px solid #DFE8E1;border-left:4px solid var(--role,#398C53);border-radius:8px;background:#F8F9F6;cursor:pointer;overflow-wrap:anywhere}
  .wd-shift.off{border-left-color:#c6d0c9;background:#fff;grid-template-columns:1fr auto;align-items:center}
  .wd-who{font-size:15px;font-weight:600}.wd-time{font-size:17px;font-weight:700}
  .wd-meta{font-size:13px;color:#4f626d}.wd-add{font-size:13px;color:#566a5e}
  .wd-open{border:1px solid #DFE8E1;border-left:4px solid #b26a00;border-radius:8px;padding:8px 10px;margin:0 0 8px;background:#fff8ea;display:grid;gap:2px}
  .wd-shift:focus-visible{outline:3px solid #0b57d0;outline-offset:2px}
  .rota-demo-note{padding:8px 14px}
  .planner-panel>.panel-header>div:first-child{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
}

/* C-R8: long unbroken strings in employee shift notes (Home week glance, Upcoming list, cards) wrap inside their box instead of being clipped; the text stays escaped and complete in the DOM, Show more still reveals it */
.emp-tasks,.g-tasks,.l-tasks,.emp-tx,.g-shift,.emp-list li{min-width:0;max-width:100%}
.g-tasks,.l-tasks,.emp-tx,.is-clamped{overflow-wrap:anywhere;word-break:break-word}
@media (max-width:767px){.g-tasks,.l-tasks{text-align:left}.g-tasks+.emp-more,.l-tasks+.emp-more{align-self:flex-start}}

/* ---------- Gate C3: compact smartphone Live Rota (the weekly schedule is reached sooner; nothing is removed, only folded or tightened) ---------- */
@media (max-width:767px), (max-height:500px) and (orientation:landscape) and (pointer:coarse){
  .lr{gap:8px}
  .rota-source{margin-bottom:8px}
  .lr-context{gap:2px 10px}.lr-context>small{flex:1 0 100%}
  .lr-status{padding:8px 12px}
  .lr-badges{margin-bottom:2px}
  .lr-vis{font-size:14px;margin:2px 0}
  .lr-status>small{display:block;font-size:12px}
  .lr-fold>details>summary{padding:2px 14px;min-height:44px}
  .lr-fold>details>summary h2{font-size:16px}
  .lr-fold-note,.lr-fold>details>ul,.lr-fold>details>p.muted{margin-left:14px;margin-right:14px;padding-left:0;padding-right:0}
  .lr-fold>details>ul.lr-leave-list{padding-left:18px}
  .lr-fold>details[open]{padding-bottom:10px}
  .lr-revlist li{padding:6px 0}
  .lr-toolbar{gap:8px;margin:0}
  .lr-toolbar .nav-tools{display:grid;grid-template-columns:44px 1fr 44px;gap:8px;width:100%}
  .lr-toolbar .nav-tools .button{width:100%;min-width:0;min-height:44px}
  .lr-actions{display:flex;gap:8px;width:100%}.lr-actions .button{min-height:44px}
  .lr>.panel{margin-bottom:0}
  /* the day cards are the content: no second card frame around them on phones */
  .lr-grid{padding:0;border:0;background:transparent;box-shadow:none}
  .lr-week{gap:8px}
  .lr-context .pill{font-size:12px;padding:3px 9px}
  .lr-context>b{font-size:15px}
}
