/* v18.2: bounded roster rendering and shared phone/tablet layouts.
   Keep the brand palette; use explicit field widths instead of overlapping controls. */
[data-roster-view], .roster-results, .op-cell-content { min-width:0; }
.roster-results { scroll-margin-top:84px; }
.roster-table-wrap { max-width:100%; overscroll-behavior-x:contain; }
.op-roster { table-layout:fixed; min-width:1280px; }
.op-roster th,.op-roster td { box-sizing:border-box; overflow-wrap:anywhere; line-height:1.5; }
.op-roster th { white-space:normal; }
.op-roster .select,.op-roster .op-roster-select,.op-roster td:first-child .select {
  display:block; width:100%; max-width:100%; min-width:0; box-sizing:border-box;
  min-height:44px; padding:9px 25px 9px 9px; font-size:14px; text-overflow:ellipsis;
}
.op-roster td .btn { max-width:100%; min-height:44px; white-space:normal; overflow-wrap:anywhere; }
.op-roster .op-check { min-height:44px; flex-wrap:wrap; gap:6px; }
.roster-filters { display:grid; grid-template-columns:minmax(180px,1.2fr) repeat(3,minmax(140px,1fr)); }
.roster-filters .op-field { min-width:0; }
.roster-day-nav,.roster-pager { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.roster-day-nav { margin:10px 0 14px; }
.roster-pager { justify-content:space-between; padding:12px 0; }
.roster-pager span,.roster-page-info { color:#475569; font-size:13px; font-weight:600; }
.roster-page-info { padding:10px 0; }
.roster-hint { color:#475569; font-size:13px; line-height:1.6; }
[data-roster-status] { display:block; min-height:20px; color:#166534; font-size:13px; }
[data-roster-view][aria-busy="true"] [data-roster-status] { color:#92400e; }
.roster-empty td { padding:24px!important; color:#64748b; }
.op-dialog p { line-height:1.65; overflow-wrap:anywhere; }
.op-dialog .row-actions { flex-wrap:wrap; }
.op-table-wrap { overscroll-behavior-x:contain; }
.op-table-wrap:focus-visible,.roster-table-wrap:focus-visible { outline:3px solid #2563eb; outline-offset:3px; }
.op-panel .toolbar>div,.op-cell-content { min-width:0; }
.op-cell-content .select,.op-cell-content .input { max-width:100%; }

@media(max-width:1024px) {
  .roster-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .op-panel .toolbar { flex-wrap:wrap; gap:12px; }
  .op-panel .toolbar>.row-actions { flex-wrap:wrap; }
  .op-matrix th:first-child,.op-matrix td:first-child { min-width:120px; max-width:160px; width:140px; }
}

/* Daily rows are independent, labeled cards on phones and portrait tablets.
   Monthly car matrices retain their own horizontal scroller, never the page. */
@media(max-width:900px) {
  .roster-table-wrap { overflow:visible; border:0; border-radius:0; background:transparent; }
  .op-roster { min-width:0!important; table-layout:auto; border:0; background:transparent; }
  .op-roster colgroup,.op-roster thead { display:none; }
  .op-roster,.op-roster tbody { display:block; width:100%; }
  .op-roster .roster-day-row { display:block; width:100%; margin:12px 0; }
  .op-roster .roster-day-row td { display:block; width:100%; border:1px solid #c7d2fe; border-radius:12px; padding:14px; }
  .op-roster tr.roster-entry {
    display:block; width:100%; padding:12px; margin:12px 0;
    border:1px solid #dbe3ed; border-radius:14px; background:#fff;
  }
  .op-roster tr.roster-entry td {
    display:grid; grid-template-columns:120px minmax(0,1fr); align-items:center;
    width:100%; gap:12px; border:0; padding:6px 0; min-width:0;
  }
  .op-roster tr.roster-entry td::before {
    content:attr(data-label); font-size:12px; font-weight:700; line-height:1.45;
    color:#475569; text-transform:none; padding:0; overflow-wrap:anywhere;
  }
  .op-roster tr.roster-entry td>* { min-width:0; max-width:100%; }
  .op-roster .op-roster-select,.op-roster .select { width:100%; max-width:100%; min-width:0!important; }
  .op-roster tr.roster-entry td:last-child { border-top:1px solid #e2e8f0; margin-top:8px; padding-top:12px; }
  .op-roster tr.roster-entry td:last-child .btn { justify-self:end; width:48px; }
  .op-roster .op-check { flex-wrap:nowrap; }
  .roster-empty,.roster-empty td { display:block; width:100%; }
}

@media(max-width:760px) {
  html { -webkit-text-size-adjust:100%; scroll-padding-top:72px; }
  html,body { max-width:100%; }
  #app,.shell,.admin-shell,.public-shell,.section,.card,.panel,.stack,.row,.row-main,
  .op-panel,.toolbar,.tool-row,.forms-2>*,.forms-3>*,.forms-4>*,.inline-fields>* { min-width:0; }
  .shell { width:100%; padding-left:max(12px,env(safe-area-inset-left)); padding-right:max(12px,env(safe-area-inset-right)); }
  .card.panel,.op-panel { border-radius:18px; }
  input:not([type="checkbox"]):not([type="radio"]),select,textarea,.input,.select {
    min-width:0; max-width:100%; font-size:16px!important; min-height:44px; line-height:1.35;
  }
  textarea { min-height:88px; }
  button,.btn,a.btn { touch-action:manipulation; }
  .btn { min-height:44px; white-space:normal; line-height:1.4; }
  .row-actions,.tool-row,.task-admin-actions { flex-wrap:wrap; gap:8px; }
  .row-actions>.btn,.tool-row>.btn { flex:1 1 auto; max-width:100%; }
  .op-form-row { gap:12px; }
  .op-form-row>.op-field { flex-basis:100%; min-width:0; }
  .op-form-row>.btn { min-width:0; }
  .op-field { min-width:0; }
  .op-panel .toolbar { display:flex; flex-direction:column; align-items:stretch; }
  .op-panel .toolbar>.row-actions { width:100%; }
  .op-panel .panel-title { font-size:20px; line-height:1.3; }
  .op-panel .panel-sub,.op-notice { overflow-wrap:anywhere; }
  .op-stats { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .op-stats>div { min-width:0; padding:12px; }
  .op-stats strong { font-size:22px; overflow-wrap:anywhere; }
  .op-stats small { font-size:12px; }
  .op-photo-stages,.op-segment { grid-template-columns:minmax(0,1fr); }
  .op-dialog {
    width:calc(100vw - 20px); max-width:720px; max-height:calc(100dvh - 24px);
    box-sizing:border-box; padding:18px; margin:auto; overscroll-behavior:contain;
  }
  .op-dialog .row-actions { display:flex; gap:10px; flex-wrap:wrap; }
  .op-dialog .row-actions .btn { flex:1 1 100%; }
  .op-dialog h2 { max-width:100%; font-size:19px; }
  .op-dialog .toolbar { gap:12px; }
  .op-photo,.op-camera { max-height:45dvh; }
  .op-table:not(.op-matrix) { min-width:0; table-layout:auto; }
  .op-table:not(.op-matrix),.op-table:not(.op-matrix)>tbody { display:block; width:100%; }
  .op-table:not(.op-matrix)>thead { display:none; }
  .op-table:not(.op-matrix)>tbody>tr { display:block; width:100%; border-bottom:2px solid #dbe3ed; padding:10px 12px; }
  .op-table:not(.op-matrix)>tbody>tr>td {
    display:grid; grid-template-columns:110px minmax(0,1fr); width:100%; gap:10px;
    min-width:0; padding:6px 0; border:0; white-space:normal; overflow-wrap:anywhere;
  }
  .op-table:not(.op-matrix)>tbody>tr>td::before { content:attr(data-label); color:#475569; font-size:12px; font-weight:700; }
  .op-table:not(.op-matrix)>tbody>tr>td[colspan] { display:block; }
  .op-cell-content,.op-cell-content small { max-width:100%; overflow-wrap:anywhere; }
  .op-table-wrap:has(.op-matrix) { max-height:70dvh; }
  .op-matrix td .btn { min-height:44px; }
  .people-detail-grid,.people-detail-list,.courier-picker-wrap,.courier-report-toolbar,
  .today-car-form,.grid-admin-top,.forms-3,.forms-4,.inline-fields,.task-board-grid {
    grid-template-columns:minmax(0,1fr)!important;
  }
  .people-heading,.people-field,.people-value,.people-detail-card { min-width:0; overflow-wrap:anywhere; }
  .people-detail-footer,.people-detail-top { flex-wrap:wrap; gap:10px; }
  .people-detail-card { content-visibility:auto; contain-intrinsic-size:auto 800px; }
  .people-detail-card:focus-within { content-visibility:visible; }
  .today-summary-grid,.report-kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .mobile-menu-sheet {
    max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    overscroll-behavior:contain;
  }
  .mobile-menu-link { min-height:52px; }
  .mobile-menu-close,.mobile-menu-trigger { min-width:44px; min-height:44px; }
  .mobile-menu-copy strong,.mobile-menu-copy span { white-space:normal; overflow-wrap:anywhere; }
  .mobile-bottom-nav { padding-bottom:max(8px,env(safe-area-inset-bottom)); }
  .toast { max-width:calc(100vw - 24px); overflow-wrap:anywhere; }
  .modal,.shift-modal-sheet { max-height:calc(100dvh - 24px); overflow:auto; overscroll-behavior:contain; }
  .op-panel,.people-detail-card,.roster-entry { box-shadow:none; }
  .mobile-menu-backdrop,.shift-modal-backdrop,.op-dialog::backdrop,.topbar { backdrop-filter:none!important; -webkit-backdrop-filter:none!important; }
  .day,.report-day,.workday-cell,.mobile-menu-link { box-shadow:none!important; }
  .roster-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .roster-filters>.op-field:first-child { grid-column:1 / -1; }
  .roster-day-nav { display:grid; grid-template-columns:1fr 1fr 1fr; gap:6px; }
  .roster-day-nav .btn { font-size:12px; padding:9px 6px; }
  .roster-pager { gap:8px; }
  .roster-pager .btn { padding:9px 10px; font-size:13px; }
}
@media(max-width:440px) {
  .op-panel { padding:12px!important; }
  .op-roster tr.roster-entry { padding:10px; }
  .op-roster tr.roster-entry td { grid-template-columns:86px minmax(0,1fr); gap:8px; }
  .op-roster tr.roster-entry td:first-child { grid-template-columns:minmax(0,1fr); gap:4px; }
  .op-roster tr.roster-entry td:first-child::before { font-size:11px; }
  .op-roster tr.roster-entry td:first-child .select { font-weight:700; }
  .roster-filters { grid-template-columns:minmax(0,1fr); }
  .op-table:not(.op-matrix)>tbody>tr>td { grid-template-columns:minmax(0,1fr); gap:3px; padding:8px 0; }
  .op-table:not(.op-matrix)>tbody>tr>td::before { font-size:11px; }
  .op-table:not(.op-matrix)>tbody>tr>td .btn { min-height:44px; }
  .roster-pager { display:grid; grid-template-columns:1fr 1fr; }
  .roster-pager span { grid-column:1 / -1; grid-row:1; text-align:center; }
  .op-stats { grid-template-columns:minmax(0,1fr); }
  .op-stats>div { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 12px; }
  .op-stats strong { margin:0; }
}
@media(hover:none) {
  .btn:hover,.mobile-menu-link:hover,.day:hover,.report-day:hover { transform:none!important; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto!important; animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; }
}

/* Legacy fuel-card, take-home and leaderboard tables get the same phone layout. */
@media(max-width:760px){
 .phone-data-table{min-width:0!important;max-width:100%;table-layout:auto!important;}
 .phone-data-table,.phone-data-table>tbody{display:block;width:100%;}
 .phone-data-table>thead{display:none;}
 .phone-data-table>tbody>tr{display:block;width:100%;padding:12px;border-bottom:2px solid #dbe3ed;}
 .phone-data-table>tbody>tr>td{display:grid;grid-template-columns:110px minmax(0,1fr);gap:10px;width:100%;padding:6px 0;white-space:normal;overflow-wrap:anywhere;border:0;}
 .phone-data-table>tbody>tr>td::before{content:attr(data-label);font-weight:700;font-size:12px;color:#475569;}
 .phone-data-table>tbody>tr>td[colspan]{display:block;}
 .phone-cell-content{min-width:0;max-width:100%;overflow-wrap:anywhere;}
 .phone-cell-content .row-actions{display:flex;flex-wrap:wrap;gap:8px;}
 .phone-cell-content .btn{max-width:100%;}
 .admin-tabbar:has([data-user-status-tab]),.people-tabbar{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;}
 .admin-tabbar [data-user-status-tab],.people-tabbar .admin-tab-button{min-width:0!important;width:100%;max-width:100%;white-space:normal;overflow-wrap:anywhere;}
 .op-dialog .toolbar{align-items:flex-start;position:relative;padding-right:44px;}
 .op-dialog .toolbar>h2{margin:0 0 12px;}
 .op-dialog .toolbar>[data-op-close]{position:absolute;right:0;top:0;}
 .op-dialog.archive-confirm .op-stats{grid-template-columns:repeat(3,minmax(0,1fr));}
 .op-dialog.archive-confirm .op-stats>div{display:flex;flex-direction:column;align-items:flex-start;padding:8px;}
 .op-dialog.archive-confirm .op-stats small{font-size:10px;}
 .op-dialog.archive-confirm .op-stats strong{font-size:22px;}
}
@media(max-width:440px){
 .phone-data-table>tbody>tr>td{grid-template-columns:minmax(0,1fr);gap:3px;padding:8px 0;}
}
/* v18.3: cancellations are an independent page, not a hidden details panel. */
.requests-panel { min-width:0; }
#adminRequestsTitle { margin:0; scroll-margin-top:90px; }
#adminRequestsTitle:focus { outline:none; }
.requests-toolbar { flex-wrap:wrap; gap:12px; }
.requests-tools { flex-wrap:wrap; margin:14px 0; }
.requests-explanation { max-width:80ch; font-size:14px; line-height:1.6; color:#475569; }
.requests-status { min-height:24px; font-size:14px; color:#475569; margin:8px 0; }
.requests-list .cancel-request-row { min-width:0; align-items:flex-start; }
.requests-list .row-main { min-width:0; flex:1 1 auto; }
.requests-list .row-title,.requests-list .row-sub { overflow-wrap:anywhere; white-space:normal; }
.requests-list .row-actions { flex:0 0 auto; flex-wrap:wrap; }
.requests-list .btn { min-height:44px; }
.requests-list .mini-input { width:100%; max-width:100%; box-sizing:border-box; }
[data-open-pending-requests]:focus-visible { outline:3px solid #2563eb; outline-offset:3px; }
@media(max-width:760px) {
  .requests-list .cancel-request-row { display:flex; flex-direction:column; align-items:stretch; gap:12px; }
  .requests-list .row-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:100%; }
  .requests-list .row-actions .btn { width:100%; white-space:normal; overflow-wrap:anywhere; }
  .requests-tools { display:grid; grid-template-columns:1fr 1fr; }
  .requests-tools .btn { min-width:0; width:100%; white-space:normal; }
  .requests-list .row-main { width:100%; }
}
/* Match the same 1100px breakpoint used by the JS compact navigation. */
@media(max-width:1100px) {
  .top-actions { display:none; }
  .mobile-menu-trigger { display:grid; place-items:center; }
}

/* v18.8.3 - visible source-connection status, without changing roster/export layout. */
.source-health-panel{margin:16px 0;border:1px solid #cbd5e1}
.source-health-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.source-health-heading>div{min-width:0;flex:1}.source-health-heading .hint{margin:7px 0 12px}
.source-release{flex:0 0 auto;padding:8px 12px;background:#eff6ff;color:#1e40af;border-radius:10px;font-weight:800;line-height:1.7}
.source-health-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.source-health-item{border:1px solid #dbe3ef;border-radius:14px;padding:14px;background:#f8fafc;min-width:0}
.source-health-item>div{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;flex-wrap:wrap}
.source-health-item b{font-size:12px;padding:4px 8px;border-radius:7px;background:#fef3c7;color:#92400e}
.source-health-item.ok b{background:#d1fae5;color:#065f46}
.source-health-item p{font-size:12px;line-height:1.55;margin:9px 0 5px;overflow-wrap:anywhere}
.source-health-item small{font-size:11px;line-height:1.5;color:#475569}
.source-health-error{padding:12px;background:#fff1f2;border:1px solid #fecdd3;color:#9f1239;border-radius:12px;overflow-wrap:anywhere}
.source-health-actions{margin-top:14px;display:flex;gap:8px;flex-wrap:wrap}
.source-origin-note{display:block;margin-top:7px;font-size:11px;line-height:1.55;color:#64748b;font-weight:500}
.source-person-check{margin-top:8px;width:100%;white-space:normal}
.source-check-details{margin-top:14px}.source-check-details summary{cursor:pointer;font-weight:750;padding:12px 0}
.brand-release{display:block;color:#64748b;font-size:10px;font-weight:600;margin-top:5px;line-height:1.2}
@media(max-width:600px){.source-health-heading{flex-direction:column;gap:6px}.source-release{align-self:flex-start}.source-health-grid{grid-template-columns:1fr}.source-health-actions{display:grid;grid-template-columns:1fr}.source-health-actions .btn{width:100%;white-space:normal}.source-health-panel{padding:16px}.source-health-item{padding:12px}}
