/* Workspace controls must fit the available content width, not the viewport. */
#appShell .main,#appShell .content,#appShell .section{min-width:0}
#appShell .card-head{flex-wrap:wrap;gap:12px}
#appShell .card-head>div{min-width:0;max-width:100%}
#sec-payroll .card-head>div:last-child,#sec-inventory .card-head>div:last-child{flex-wrap:wrap;gap:8px;align-items:center}
#sec-payroll .card-head .btn-icon,#sec-inventory .card-head .btn-icon{height:36px;min-height:36px;flex:0 0 auto;white-space:nowrap;justify-content:center;padding:0 12px;line-height:1.2}
#payPeriodType,#invCatFilter{width:auto;max-width:100%;min-width:0;height:36px!important;padding:0 10px!important;flex:0 1 auto}
#payCustomWrap{flex-wrap:wrap;max-width:100%}
#payCustomWrap input{min-width:0;max-width:100%;height:36px!important}
#sec-report>.card>.card-body{padding:16px 20px}
#sec-report .card-body>div{min-width:0;max-width:100%}
#sec-report input,#sec-report select{min-width:0!important;max-width:100%;box-sizing:border-box}
#sec-report .card-body>div>div{min-width:0;max-width:100%}
#sec-report button{min-height:36px;white-space:nowrap}
#subscriptionContent{padding:20px;min-width:0}
#subscriptionContent .tb-plan-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr))}
#subscriptionContent .tb-plan-card{min-width:0;max-width:100%;overflow-wrap:anywhere}
#subscriptionContent .tb-plan-card-top{flex-wrap:wrap;gap:8px}
#subscriptionContent .tb-plan-price{font-size:clamp(28px,3vw,38px)}
#subscriptionContent .tb-plan-action{white-space:normal;text-align:center}
#addChecklistTask[hidden],#addCleaningTask[hidden]{display:none!important}
#addChecklistTask,#addCleaningTask{min-height:36px;white-space:nowrap;margin-left:auto;justify-content:center}
#sec-checklist .card-head>div:last-child{margin-left:0}
#sec-messages .msg-shell,#sec-messages .msg-pane,#sec-messages .msg-bubbles{min-width:0;min-height:0}
#sec-messages .msg-footer{box-sizing:border-box;width:100%;max-width:100%;align-items:center;gap:8px;background:var(--bg-card)}
#sec-messages .msg-footer[hidden]{display:none!important}
#sec-messages .msg-inp{width:0;min-width:0;flex:1 1 0;height:42px;box-sizing:border-box}
#sec-messages .btn-send{flex:0 0 auto;height:42px;box-sizing:border-box;white-space:nowrap}
#sec-messages .bubble{overflow-wrap:anywhere}
#scheduleCard>.card-head{align-items:center}
#schedWeekLabel{font-size:16px!important;line-height:1.5;color:var(--fg);white-space:normal;flex:1 1 200px}
#scheduleCard>.card-head>div:last-child{flex-wrap:wrap;margin-left:auto}
#schedGrid .sc-head{font-size:13px;color:var(--fg-2);line-height:1.4;padding-top:12px;padding-bottom:12px}
#schedGrid .schedule-day-number{display:block;margin-top:4px;font-size:18px;font-weight:750;color:var(--fg);line-height:1.3}
#schedGrid .today-col .schedule-day-number{color:var(--accent-text)}
@media(min-width:768px){#sec-messages .msg-shell{grid-template-columns:minmax(160px,28%) minmax(0,1fr)}}
@media(max-width:600px){
 #sec-report>.card>.card-body,#subscriptionContent{padding:14px}
 #sec-report .card-body>div:first-child>div:nth-child(-n+2){flex:1 1 120px}
 #sec-payroll .card-head>div:last-child,#sec-inventory .card-head>div:last-child{width:100%}
 #sec-messages .msg-footer{padding:10px}
 #scheduleCard>.card-head>div:last-child{margin-left:0}
}

/* Consistent management actions and space between controls and card borders. */
#sec-checklist .card-head button,
#sec-cleaning .card-head button,
#sec-notifications .card-head button,
#sec-contacts .card-head button{
 display:inline-flex;align-items:center;justify-content:center;
 height:36px;min-height:36px;box-sizing:border-box;
 padding:0 14px!important;font-size:13px!important;line-height:1.2;
 border-radius:8px!important;white-space:nowrap;
}
#sec-checklist .card-head>div:last-child{align-items:center}
#sec-notifications .card-head+div,
#sec-contacts .card-head+div{padding:16px 20px!important;gap:8px;align-items:center}
#sec-notifications .card-head+div button{min-height:36px;padding:7px 12px!important;line-height:1.2}
#contactCatFilter,#contactSearch{height:38px;box-sizing:border-box;min-width:0!important}
#contactCatFilter{flex:0 1 200px;max-width:100%}
#contactSearch{flex:1 1 160px!important}
#sec-tips>.card:first-child>.card-body{padding:20px}
#sec-tips>.card:first-child>.card-body>div{min-width:0}
#sec-tips input{min-width:0;box-sizing:border-box}
#tipModeEqual,#tipModeHours,#tipModeCustom{min-height:40px;line-height:1.3}
#sec-tips .card-body>div>div:has(#tipHouseCut){flex-wrap:wrap;row-gap:8px}
#sec-tips button[onclick="saveTipRecord()"]{min-height:42px;line-height:1.3}
@media(max-width:600px){
 #sec-notifications .card-head+div,#sec-contacts .card-head+div{padding:16px!important}
 #sec-tips>.card:first-child>.card-body{padding:16px}
}

/* Team compensation and routine actions stay readable at narrow widths. */
.staff-rate{font-size:13px;font-weight:600;color:var(--fg-2);align-self:center}
.task-actions{display:flex;flex-wrap:wrap;gap:8px;flex-shrink:0}
.task-actions button{min-height:36px;padding:0 12px;white-space:nowrap}
#rptTableCard .tbl-wrap{overflow-x:auto;max-width:100%}
#rptTable{min-width:1040px}
#rptTable th,#rptTable td{padding:14px 16px;vertical-align:top}
#rptTable details{min-width:160px}
#rptTable summary{cursor:pointer;color:var(--accent);font-weight:600}
#rptTable details[open]{min-width:320px}

.announcement-remove{margin-top:12px;min-height:36px;padding:0 14px}
.attendance-state{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap}
.attendance-state.working{background:#dcfce7;color:#166534}
.attendance-state.on-break{background:#fef3c7;color:#92400e}
.attendance-state.off-duty{background:var(--bg);color:var(--fg-2);border:1px solid var(--border)}
#sec-latealert>.card>.card-body{padding:20px}
.team-employee-options{max-height:230px;overflow-y:auto;margin:0 0 16px;border:1px solid var(--border);border-radius:10px;background:var(--bg-card)}
.team-employee-options[hidden]{display:none}
.team-employee-options button{display:block;width:100%;text-align:left;padding:12px 14px;border:0;border-bottom:1px solid var(--border);background:transparent;color:var(--fg);font:inherit;cursor:pointer}
.team-employee-options button:hover,.team-employee-options button:focus{background:var(--accent-light);outline:2px solid var(--accent);outline-offset:-2px}
.team-employee-options p{padding:12px 14px;color:var(--fg-2)}
@media(max-width:600px){#sec-latealert>.card>.card-body{padding:16px}}

.staff-rate{display:inline-flex;align-items:center;min-height:34px;padding:0 12px;border:1px solid var(--border);border-radius:8px;background:var(--bg);font-variant-numeric:tabular-nums}
#payTiles .pt-value{font-size:22px!important;line-height:1.3;font-weight:700;overflow-wrap:anywhere}
#payTiles .pt-label{font-size:11px;line-height:1.4}

/* Consistent controls, readable mobile headings, and keyboard-safe dialogs. */
#tbStoreEditDialog .coverage-hours{display:grid;gap:16px;max-width:560px}
#tbStoreEditDialog label{display:grid;gap:7px;font-size:13px;font-weight:600}
#tbStoreEditDialog input,#tbStoreEditDialog select{display:block;box-sizing:border-box;width:100%;min-width:0;min-height:46px;padding:11px 12px;font:inherit;font-size:16px;border:1px solid var(--border);border-radius:9px;background:var(--bg-input);color:var(--fg);margin:0}
#tbStoreEditDialog .coverage-save{margin:0;min-height:46px;font-weight:650}
#tbStoreEditDialog .btn-sm{min-height:44px;white-space:normal}
#tbStoreEditDialog .coverage-error:empty{display:none}
#tbStoreEditDialog{padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom))}
#tbStoreEditDialog .coverage-hours{max-height:calc(100dvh - 32px);overscroll-behavior:contain}
#tbAiConversation:empty{display:none}
#tbAiConversation:not(:empty)::before{content:"AI response";display:block;font-size:12px;font-weight:650;color:var(--fg-2);margin-bottom:8px}
#tbAiQuestion{width:100%;box-sizing:border-box;min-height:120px;background:var(--bg-card);font-size:16px;resize:vertical}
#tbAiFormError{margin:0;color:var(--red);font-size:14px}
#tbAiFormError:empty{display:none}
#tbAiForm>label{font-size:14px;font-weight:650}
#tbAiForm>button{min-height:44px;background:var(--accent);color:#fff;border-color:var(--accent)}
#appShell .section .card-head .card-title{font-size:16px;line-height:1.35}
#appShell .section .card-head button{min-height:40px;max-width:100%;box-sizing:border-box}
#appShell .section input,#appShell .section select,#appShell .section textarea{max-width:100%;box-sizing:border-box}
#appShell .section .card{min-width:0;max-width:100%;box-sizing:border-box}
#sec-checklist .card-head+div,#sec-cleaning .card-head+div{flex-wrap:wrap}
#sec-checklist .card-head+div button,#sec-cleaning .card-head+div button{min-height:40px;padding:8px 14px!important;font-size:13px!important;line-height:1.2}
@media(max-width:767px){
 #appShell .topbar{height:auto;min-height:64px;padding:10px 16px;gap:8px;flex-wrap:wrap;align-items:center}
 #appShell .topbar .tb-title-wrap{min-width:0;flex:1 1 auto}
 #appShell .topbar #topbarTitle{font-size:18px;font-weight:700;line-height:1.3;white-space:nowrap;letter-spacing:-.35px}
 #appShell .topbar .tb-actions{gap:6px;margin-left:auto;flex-wrap:wrap}
 #appShell .topbar .btn-icon,#appShell .topbar button:has(#themeIcon){width:36px;min-width:36px;height:40px;min-height:40px;padding:0;justify-content:center}
 #appShell .topbar .mobile-more-back{width:36px;min-width:36px;height:40px;min-height:40px;padding:0;margin:0;flex-shrink:0}
 #appShell .topbar #addBtn{min-height:40px;font-size:13px;padding:8px 12px;white-space:nowrap}
 #appShell .content{padding:16px 16px calc(112px + env(safe-area-inset-bottom,0px));scroll-padding-bottom:calc(112px + env(safe-area-inset-bottom,0px))}
 #appShell .section .card-head{padding:16px;gap:10px}
 #appShell .section .card-head .card-title{font-size:16px}
 .task-actions{gap:6px}
 .task-actions button{padding:0 8px;font-size:12px}
 #tbAiForm{scroll-margin-bottom:110px}
 #appShell.active:has(#tbAiQuestion:focus){top:var(--tb-viewport-top,0px);bottom:auto}
 #appShell.active:has(#tbAiQuestion:focus) #mobileTabBar{display:none}
 #appShell.active:has(#tbAiQuestion:focus)>.main>.content{padding-bottom:16px;scroll-padding-bottom:16px}
 #tbAiQuestion{scroll-margin-block:12px}
}
@media(max-width:380px){
 #appShell .topbar .tb-actions{flex-basis:100%;justify-content:flex-end}
 #appShell .topbar #topbarTitle{font-size:18px}
}


/* Shared routines: native keyboard controls with comfortable touch targets. */
.routine-task-row{display:grid;grid-template-columns:44px minmax(0,1fr) auto;align-items:center;gap:12px;padding:12px 20px;border-bottom:1px solid var(--border)}
.routine-check{box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:44px;min-width:44px;height:44px;min-height:44px;margin:0;padding:0;border:0;border-radius:9px;background:transparent;color:var(--fg);cursor:pointer;touch-action:manipulation}
.routine-check-box{box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border:2px solid var(--fg-3);border-radius:6px;font-size:16px;font-weight:700;line-height:1}
.routine-check[aria-checked="true"] .routine-check-box{border-color:var(--green);background:var(--green);color:#fff}
.routine-check:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.routine-check[aria-disabled="true"]{opacity:.55;cursor:wait}
.routine-task-copy{min-width:0;overflow-wrap:anywhere}
.routine-task-title{font-size:14px;line-height:1.5}
.routine-task-meta{font-size:12px;line-height:1.5;color:var(--fg-2)}
.routine-task-row.is-complete .routine-task-title{text-decoration:line-through;color:var(--fg-2)}
.routine-task-row .task-actions button{min-height:44px;min-width:44px}
@media(max-width:480px){
 .routine-task-row{grid-template-columns:44px minmax(0,1fr);gap:8px 10px;padding:12px 16px}
 .routine-task-row .task-actions{grid-column:2/-1;justify-content:flex-end;min-width:0}
}

/* Payroll actions share one size; the period selector gets its own mobile row. */
#appShell #sec-payroll .payroll-hours-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
#appShell #sec-payroll .payroll-hours-actions .btn-icon,
#appShell #sec-payroll .payroll-hours-actions #payPeriodType{
 box-sizing:border-box;height:44px!important;min-height:44px;max-height:44px;
 padding:0 12px!important;border-radius:8px;font-size:12px;line-height:1.2;
 white-space:nowrap;display:inline-flex;align-items:center;justify-content:center;
}
#appShell #sec-payroll .payroll-hours-actions .btn-icon{flex:0 0 140px;width:140px}
#appShell #sec-payroll .payroll-hours-actions #payPeriodType{width:140px;flex:0 0 140px}
@media(max-width:700px){
 #appShell #sec-payroll .payroll-hours-head{align-items:stretch}
 #appShell #sec-payroll .payroll-hours-title{flex-basis:100%}
 #appShell #sec-payroll .payroll-hours-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%;gap:8px}
 #appShell #sec-payroll .payroll-hours-actions #payPeriodType{grid-column:1/-1;width:100%;font-size:14px}
 #appShell #sec-payroll .payroll-hours-actions .btn-icon{width:100%;min-width:0;padding:0 4px!important;font-size:11px}
 #appShell #sec-payroll .payroll-hours-actions #payCustomWrap{grid-column:1/-1}
}
/* Grid cards must shrink within their parent, including their outer margins. */
#appShell[data-more-detail] #mobileMoreDetail{min-width:0;max-width:100%}
#appShell[data-more-detail] #mobileMoreDetail>.mobile-more-card{
 box-sizing:border-box;width:calc(100% - 28px);max-width:calc(100% - 28px);
 min-width:0;margin-left:14px;margin-right:14px;grid-template-columns:minmax(0,1fr);
}
#mobileMoreDetail>.mobile-more-card>*{min-width:0;max-width:100%;box-sizing:border-box}
#tbAiForm{min-width:0;grid-template-columns:minmax(0,1fr)}
#tbAiChatMode,#tbAiScheduleMode{height:40px;min-height:40px;flex:1;white-space:nowrap}

/* Keep the weekday label separate from its circular date marker. */
#appShell #sec-schedule #scheduleDates button[data-schedule-date]:not(.staff-week-view){
 border:0;background:transparent;color:var(--fg-2);border-radius:6px;box-shadow:none;
}
#appShell #sec-schedule #scheduleDates button[data-schedule-date]:not(.staff-week-view) strong{
 display:grid;place-items:center;width:28px;height:28px;box-sizing:border-box;
 border:1px solid var(--border);border-radius:50%;color:inherit;line-height:1;
}
#appShell #sec-schedule #scheduleDates button[data-schedule-date][aria-current="date"]:not(.staff-week-view) strong{
 border-color:var(--accent);color:var(--accent-text);
}
#appShell #sec-schedule #scheduleDates button[data-schedule-date][aria-pressed="true"]:not(.staff-week-view) strong{
 border-color:var(--accent);background:var(--accent);color:white;
}

#appShell #sec-schedule #schedGrid.staff-agenda .staff-agenda-date{
 border:0;border-radius:0;box-shadow:none;background:transparent;
}
@media(min-width:768px){
 #appShell #sec-schedule #schedGrid.staff-agenda .staff-agenda-day{
  display:grid;gap:5px;margin:0 0 0 16px;padding:9px 0 5px;
 }
 #appShell #sec-schedule #schedGrid.staff-agenda .staff-agenda-day + .staff-agenda-day{
  border-top:1px solid var(--border);
 }
 #appShell #sec-schedule #schedGrid.staff-agenda .staff-agenda-date{
  position:relative;margin:0;padding:0;line-height:1.25;
 }
 #appShell #sec-schedule #schedGrid.staff-agenda .staff-agenda-date::before{
  content:"";position:absolute;left:-16px;top:50%;transform:translateY(-50%);
  width:8px;height:8px;border-radius:50%;background:var(--accent);
 }
 #appShell #sec-schedule #schedGrid.staff-agenda .staff-agenda-empty{
  margin:0;padding:0;line-height:1.3;color:var(--fg-3);
 }
 #appShell #sec-schedule #schedGrid.staff-agenda .staff-shift-row{
  margin:0;
 }
}
@media(max-width:600px){
 #appShell .routine-task-row{grid-template-columns:44px minmax(0,1fr) auto;gap:6px;padding:8px 12px;align-items:center}
 #appShell .routine-task-row .task-actions{grid-column:auto;display:flex;flex-wrap:nowrap;gap:4px;align-items:center}
 #appShell .routine-task-row .task-actions button{min-height:44px;min-width:44px;padding:0 6px;font-size:12px;white-space:nowrap}
 #appShell .routine-task-title{white-space:normal;overflow:visible;text-overflow:clip;line-height:1.35}
 #appShell .health-item{grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:6px}
 #appShell .health-item-actions{flex-wrap:nowrap;gap:4px;padding:0}
 #appShell .health-item-actions button{min-width:44px;min-height:44px;padding:0 6px;font-size:12px;white-space:nowrap}
}

/* Align the Tips calculator with its heading, keeping the description below. */
#appShell #sec-payroll .card-head:has(#tipTotalBadge){
 display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:6px 12px;
}
#appShell #sec-payroll .card-head:has(#tipTotalBadge)>div:first-child{display:contents}
#appShell #sec-payroll .card-head:has(#tipTotalBadge) .card-title{grid-column:1;grid-row:1}
#appShell #sec-payroll .card-head:has(#tipTotalBadge) .card-meta{grid-column:1/-1;grid-row:2}
#appShell #sec-payroll .card-head:has(#tipTotalBadge)>div:last-child{
 grid-column:2;grid-row:1;width:auto;justify-content:flex-end;flex-wrap:wrap;
}
#appShell #sec-payroll .card-head:has(#tipTotalBadge) button{min-height:44px;margin:0;white-space:nowrap}
#tipTotalBadge:empty{display:none}
/* Recorded attendance times stay together beside the event and map link. */
#teamAttendance table th,#teamAttendance table td{padding:12px 8px;vertical-align:middle}
#teamAttendance table th:nth-child(2),#teamAttendance table td:nth-child(2){white-space:nowrap}

/* Compact dashboard widgets and consistent outline toolbar icons. */
#appShell .topbar #pushBtn svg,#appShell .topbar #alertBellBtn svg{width:22px;height:22px;flex:none}
#appShell .topbar #pushBtn,#appShell .topbar #alertBellBtn{color:var(--fg-2);align-items:center;justify-content:center}
#appShell #sec-dashboard .stat-tile{padding:14px;border-radius:12px}
#appShell #sec-dashboard .st-icon-row{margin-bottom:8px;gap:6px}
#appShell #sec-dashboard .st-icon{width:30px;height:30px;border-radius:9px;flex-shrink:0}
#appShell #sec-dashboard .st-icon svg{width:18px;height:18px}
#appShell #sec-dashboard .st-label{color:var(--fg-2);font-weight:600;line-height:1.35;margin-bottom:5px}
#appShell #sec-dashboard .st-value{font-size:25px;line-height:1.1;font-weight:750}
#appShell #sec-dashboard .st-sub{color:var(--fg-2);font-size:11px;line-height:1.4}
#appShell #sec-dashboard .st-trend{white-space:normal;text-align:right;font-size:10px;padding:2px 4px}
#appShell #sec-dashboard .st-bar{margin-top:8px}

/* Colorful, compact dashboard cards with a consistent visual hierarchy. */
#appShell #dashWidgetGrid .stat-tile{position:relative;isolation:isolate;overflow:hidden;min-height:154px;box-sizing:border-box;border:1px solid #ffffff45;border-radius:16px;padding:18px 16px 14px;background:linear-gradient(145deg,#83b8eb,#356bc2);color:#fff;box-shadow:0 4px 12px #163d7810}
#appShell #dashWidgetGrid .stat-tile::before{content:"";position:absolute;inset:0;z-index:-1;background:radial-gradient(ellipse at 20% 0%,#ffffff35,transparent 70%);pointer-events:none}
#appShell #dashWidgetGrid [data-widget-id="checklist"],#appShell #dashWidgetGrid [data-widget-id="clocked_in"]{background:linear-gradient(145deg,#67b88b,#23794f)}
#appShell #dashWidgetGrid [data-widget-id="cleaning"],#appShell #dashWidgetGrid [data-widget-id="today_schedule"]{background:linear-gradient(145deg,#a28ae8,#6446c3)}
#appShell #dashWidgetGrid [data-widget-id="announcements"],#appShell #dashWidgetGrid [data-widget-id="inventory_alerts"]{background:linear-gradient(145deg,#e9ac63,#a85a21)}
#appShell #dashWidgetGrid [data-widget-id="cover_needed"],#appShell #dashWidgetGrid [data-widget-id="late_today"]{background:linear-gradient(145deg,#e69595,#b74760)}
#appShell #dashWidgetGrid .st-icon-row{position:absolute;inset:13px 12px auto auto;margin:0}
#appShell #dashWidgetGrid .st-icon{width:44px;height:44px;border-radius:13px;background:#ffffff22!important;color:#fff!important;transform:rotate(-8deg);box-shadow:0 4px 9px #163d7815}
#appShell #dashWidgetGrid .st-icon svg{width:28px;height:28px}
#appShell #dashWidgetGrid .st-label{position:relative;max-width:calc(100% - 44px);min-height:34px;margin:0 0 12px;color:#fff;font-size:13px;font-weight:650;line-height:1.3}
#appShell #dashWidgetGrid .st-value{color:#fff!important;font-size:30px;line-height:1.1;letter-spacing:-.03em}
#appShell #dashWidgetGrid .st-sub{color:#fff;font-size:11px;line-height:1.4;margin-top:5px}
#appShell #dashWidgetGrid .st-trend{position:absolute;right:0;top:48px;max-width:76px;background:#17204475!important;color:#fff!important;font-size:9px;text-align:center}
#appShell #dashWidgetGrid .st-bar{height:4px;background:#ffffff40;margin-top:10px}
#appShell #dashWidgetGrid .st-bar-fill{background:#fff!important}
#appShell #dashWidgetGrid .stat-tile:focus-visible{outline:3px solid var(--fg);outline-offset:3px}
/* One viewport and one scrolling body, including Messages and More detail pages. */
@media(max-width:767px){
 html:has(#appShell.active),body:has(#appShell.active){height:100%;overflow:hidden;overscroll-behavior:none}
 #appShell.active{position:fixed;inset:0;height:100dvh;max-height:100dvh;overflow:hidden}
 #appShell .main{height:100%;min-height:0;min-width:0;overflow:hidden}
 #appShell .topbar{position:relative;z-index:110;flex-shrink:0}
 #appShell .content{min-height:0;overflow-y:auto;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
 #appShell.active #mobileTabBar{position:fixed;z-index:120;transform:none}
 #appShell[data-mobile-section=messages] .content{padding-top:0}
 #appShell #sec-messages .message-toolbar{position:sticky;top:-1px;z-index:110;margin:0 -16px 14px;padding:calc(10px + var(--tb-safe-top,env(safe-area-inset-top,0px))) 16px 10px;background:var(--bg-card);border-bottom:1px solid var(--border)}
 #appShell #sec-messages .message-thread-header{position:sticky;top:0;z-index:110;background:var(--bg-card);padding-top:var(--tb-safe-top,env(safe-area-inset-top,0px))}
 #appShell[data-more-detail] .mobile-profile-header{position:sticky;top:0;z-index:110;margin-top:0;padding-top:calc(10px + var(--tb-safe-top,env(safe-area-inset-top,0px)))}
 #appShell #dashWidgetGrid{gap:10px}
}
.attendance-event-action{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;line-height:1.35}
.attendance-location-link{display:flex;align-items:center;justify-content:center;gap:4px;min-height:44px;margin:0;color:var(--accent);font-size:12px;font-weight:600;text-decoration:underline;line-height:1.2}
.attendance-location-missing{display:block;font-size:12px;color:var(--fg-3);margin-top:3px}
#teamAttendance table th:last-child,#teamAttendance table td:last-child{text-align:center}
#teamAttendance table td{padding-top:10px;padding-bottom:10px}

/* Distinct widget tones, even when related cards sit beside each other. */
#appShell #dashWidgetGrid [data-widget-id="clocked_in"]{background:linear-gradient(145deg,#57b7ab,#207c79)}
#appShell #dashWidgetGrid [data-widget-id="checklist"]{background:linear-gradient(145deg,#70b785,#31774a)}
#appShell #dashWidgetGrid [data-widget-id="late_today"]{background:linear-gradient(145deg,#e9a184,#bb654b)}
#appShell #dashWidgetGrid [data-widget-id="cover_needed"]{background:linear-gradient(145deg,#df91ac,#ad476e)}
#appShell #dashWidgetGrid [data-widget-id="pending_approvals"]{background:linear-gradient(145deg,#8fb4e5,#4769bb)}
#appShell #dashWidgetGrid [data-widget-id="cleaning"]{background:linear-gradient(145deg,#ac94e7,#7652c1)}
#appShell #dashWidgetGrid [data-widget-id="announcements"]{background:linear-gradient(145deg,#e7b56e,#ae712c)}
#appShell #dashWidgetGrid [data-widget-id="inventory_alerts"]{background:linear-gradient(145deg,#dca188,#ac6651)}
#appShell #dashWidgetGrid [data-widget-id="today_schedule"]{background:linear-gradient(145deg,#899de7,#5563b5)}
#appShell #dashWidgetGrid [data-widget-id="expiring_certs"]{background:linear-gradient(145deg,#87bdc8,#427d95)}
@media(max-width:767px){
 #appShell{touch-action:pan-x pan-y}
 #appShell input,#appShell select,#appShell textarea,.modal input,.modal select,.modal textarea{font-size:16px!important}
 #widgetManagerModal{touch-action:pan-y}
 #widgetManagerModal .modal{width:min(100%,480px);max-width:100%;box-sizing:border-box}
 #widgetManagerList{min-width:0}
 #widgetManagerList .widget-manager-name{min-width:0;overflow-wrap:anywhere}
}

/* Store editor fields always occupy their own full-width row. */
#tbStoreEditDialog .coverage-hours{display:grid;gap:16px;width:min(100%,560px);box-sizing:border-box;padding:20px}
#tbStoreEditDialog fieldset{display:grid;gap:16px;min-width:0}
#tbStoreEditDialog legend{font-size:14px;font-weight:700;margin-bottom:12px}
#tbStoreEditDialog label{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;min-width:0;font-size:14px;font-weight:600;line-height:1.4}
#tbStoreEditDialog input,#tbStoreEditDialog select{display:block;width:100%;min-width:0;min-height:50px;box-sizing:border-box;margin:0;padding:12px 14px;font:inherit;font-size:16px;color:var(--fg);background:var(--bg-input);border:1px solid var(--border);border-radius:10px}
#tbStoreEditDialog button{min-height:44px}


/* One bounded app viewport; only content and explicit table panes scroll. */
html.tb-app-active,html.tb-app-active body{height:100%;overflow:hidden;overscroll-behavior:none}
#appShell.active{position:fixed;inset:0;width:100%;max-width:100%;height:var(--tb-app-height,100dvh);max-height:var(--tb-app-height,100dvh);overflow:hidden;overscroll-behavior:none}
#appShell.active>.main{display:flex;flex-direction:column;flex:1 1 0;min-width:0;min-height:0;height:100%;overflow:hidden}
#appShell.active>.main>.topbar{position:relative;flex:0 0 auto;z-index:110;transform:none}
#appShell.active>.main>.content{flex:1 1 0;min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain}
#appShell .section{max-width:100%}
.attendance-punch-records{box-sizing:border-box;width:100%;min-width:0;padding:14px}
.attendance-punch-table{width:100%!important;min-width:0!important;table-layout:fixed!important;font-size:13px}
.attendance-punch-table th,.attendance-punch-table td{box-sizing:border-box;padding:12px 8px!important;vertical-align:top;white-space:normal!important;overflow-wrap:anywhere;text-align:left!important}
.attendance-punch-table th:first-child,.attendance-punch-table td:first-child{width:40%}
.attendance-punch-table th:last-child,.attendance-punch-table td:last-child{width:60%}
.attendance-punch-table .attendance-event-action{align-items:flex-start!important;text-align:left!important;gap:6px!important}
.payroll-employee-detail{border-top:1px solid var(--border);background:var(--bg);min-width:0;max-width:100%}
.payroll-detail-name{padding:14px 14px 0;font-size:14px;font-weight:700}
.payroll-session-wrap{max-width:100%;overflow-x:auto}
.payroll-session-table{min-width:520px;width:100%}
#rptTable th,#rptTable td{white-space:nowrap}
#sec-report>.card>.card-body{padding:16px 20px!important}
#sec-report .report-range-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:18px}
#sec-report .report-presets{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:8px}
#sec-report .report-run-btn{grid-column:1/-1;justify-self:stretch;min-height:44px;width:100%;font:inherit;font-size:14px;font-weight:650}
#sec-report .report-range-controls input{min-height:44px;width:100%}
#sec-report #rptEmployee{min-height:44px;width:100%}
#addShiftPicker .shift-weekdays{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;margin-top:6px}
#addShiftPicker .day-chip{position:relative;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;min-height:44px;padding:4px 0;box-sizing:border-box;border-radius:6px;font-size:12px;line-height:1}
#addShiftPicker .day-chip input{display:block;position:absolute;opacity:0;width:1px;height:1px}
#addShiftPicker .day-chip:focus-within{outline:2px solid var(--accent);outline-offset:2px}
@media(max-width:767px){
 #appShell.active #mobileTabBar{position:absolute;bottom:max(8px,env(safe-area-inset-bottom,0px));transform:none}
 #appShell.active>.main>.topbar{padding-top:calc(10px + env(safe-area-inset-top,0px));flex-wrap:nowrap}
 #appShell .topbar .tb-title-wrap{flex:1 1 0;min-width:0}
 #appShell .topbar #topbarTitle{white-space:normal;font-size:clamp(15px,4.4vw,18px);line-height:1.2;overflow-wrap:normal}
 #appShell .topbar .tb-actions{flex:0 0 auto;flex-wrap:nowrap;gap:4px}
 #appShell .topbar .btn-icon,#appShell .topbar button:has(#themeIcon){width:32px;min-width:32px}
 #appShell .topbar .mobile-more-back{flex:0 0 32px;min-width:32px;width:32px}
 #appShell .topbar #addBtn{font-size:12px;padding:8px}
 #appShell[data-mobile-section=messages]>.main>.content{padding:0 16px calc(90px + env(safe-area-inset-bottom,0px));overflow:hidden}
 #appShell #sec-messages.active{display:flex;flex-direction:column;height:100%;min-height:0}
 #appShell #sec-messages .message-toolbar{position:relative;top:auto;flex:none;margin:0 -16px 10px;padding:calc(10px + env(safe-area-inset-top,0px)) 16px 10px;z-index:110}
 #sec-messages .message-filters,#messageSearchWrap{flex:none}
 #appShell #sec-messages .msg-shell:not([hidden]){flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:contain;height:auto}
 #appShell #sec-messages[data-thread-open] .msg-shell{display:flex;overflow:hidden}
 #appShell #sec-messages[data-thread-open] .msg-pane{display:flex;flex-direction:column;flex:1;min-height:0}
 #appShell #sec-messages .message-thread-header{flex:none;position:relative;top:auto}
 #appShell #sec-messages .msg-bubbles{flex:1 1 0;min-height:0;height:auto;overflow-y:auto;overscroll-behavior:contain}
 #appShell #sec-messages .msg-footer{flex:none}
 #sec-report>.card>.card-body{padding:16px!important}
 #addShiftPicker .modal{width:calc(100% - 24px);max-width:420px!important;min-width:0}
 .modal-overlay{overscroll-behavior:contain;touch-action:pan-y}
 .modal-overlay .modal{max-width:calc(100% - 24px);max-height:calc(var(--tb-app-height,100dvh) - 24px);min-width:0;box-sizing:border-box}
 .modal-overlay .modal-body{min-width:0;overflow-y:auto;overscroll-behavior:contain}
 .modal-overlay .modal-head,.modal-overlay .modal-footer{flex-shrink:0}
}
@media(max-width:380px){
 #sec-report .report-range-controls{grid-template-columns:minmax(0,1fr)}
}
html.tb-app-active{touch-action:pan-x pan-y}
@media(max-width:767px){#appShell.active>.main>.content{overflow-x:hidden}}

/* Keep navigation and close controls reachable in long menus and dialogs. */
@media(max-width:767px){
 #appShell #messageAnnouncements:not([hidden]){flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:contain}
 .modal-overlay .modal-head,.coverage-hours>header,.message-picker-toolbar{position:sticky;top:0;z-index:5;background:var(--bg-card)}
}

/* Report controls share one inset and one full-width action grid. */
#sec-report .report-range-controls{width:100%;box-sizing:border-box;min-width:0;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:12px}
#sec-report .report-range-controls>div{min-width:0;width:100%;box-sizing:border-box}
#sec-report .report-range-controls input[type=date]{display:block;appearance:none;-webkit-appearance:none;box-sizing:border-box;width:100%;inline-size:100%;min-width:0!important;min-inline-size:0;max-width:100%;max-inline-size:100%;padding:10px 8px;overflow:hidden}
#sec-report input[type=date]::-webkit-date-and-time-value{min-width:0;text-align:center}
#sec-report input[type=date]::-webkit-datetime-edit{min-width:0;padding:0}
#sec-report .report-presets{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;width:100%;min-width:0}
#sec-report .report-presets .btn-sm-outline{display:flex;align-items:center;justify-content:center;width:100%;min-width:0;min-height:44px;box-sizing:border-box;padding:6px 3px;font-size:clamp(10px,2.8vw,12px);line-height:1.2;white-space:normal;text-align:center}
#sec-report #rptCustomRange{grid-column:1/-1}
#sec-report .report-run-btn{min-height:44px;margin:0}
#sec-contacts #contactCatFilter,#sec-contacts #contactSearch{height:50px;min-height:50px;line-height:1.3;padding:10px 14px;font-size:16px;box-sizing:border-box}
#sec-contacts #contactCatFilter{width:100%;max-width:100%;flex:1 1 220px}
/* A five-column invoice list, with actions on the detail screen. */
#appShell #invoiceTable{width:100%;min-width:0;table-layout:fixed;border-collapse:collapse}
#invoiceTable th:nth-child(1){width:12%}#invoiceTable th:nth-child(2){width:24%}#invoiceTable th:nth-child(3){width:21%}#invoiceTable th:nth-child(4){width:23%}#invoiceTable th:nth-child(5){width:20%}
#appShell #invoiceTable th,#appShell #invoiceTable td{box-sizing:border-box;padding:12px 8px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-bottom:1px solid var(--border);border-right:1px solid var(--border)}
#appShell #invoiceTable th:last-child,#appShell #invoiceTable td:last-child{border-right:0}
#invoiceTable tbody tr:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
#invoiceTable .badge{max-width:100%;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis}
.invoice-details-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;margin:0 0 20px}
.invoice-details-grid div{min-width:0}.invoice-details-grid dt{font-size:12px;color:var(--fg-2);margin-bottom:5px}.invoice-details-grid dd{margin:0;overflow-wrap:anywhere;font-size:15px}
.invoice-details-items{width:100%;border-collapse:collapse;table-layout:fixed}.invoice-details-items th,.invoice-details-items td{padding:10px 6px;overflow-wrap:anywhere;border-bottom:1px solid var(--border);text-align:left}
.invoice-details-items th:first-child{width:50%}.invoice-details-note{white-space:pre-wrap;overflow-wrap:anywhere}
#invoiceDetailsModal .modal-foot{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
#invoiceDetailsModal .modal-foot button{min-width:0;min-height:44px;margin:0;padding:8px}
@media(max-width:767px){
 #sec-contacts .card-head+div{display:grid!important;grid-template-columns:minmax(0,1fr)}
 #appShell #invoiceTable th,#appShell #invoiceTable td{padding:12px 5px;font-size:11px;letter-spacing:0}
 #appShell #invoiceTable .badge{padding:4px;font-size:10px}
 #appShell #sec-invoices .card-head{display:flex;gap:8px}
 #appShell #sec-invoices .card-head>div:last-child{display:flex;flex-wrap:wrap;gap:8px}
}
@media(max-width:380px){#sec-report .report-range-controls{grid-template-columns:minmax(0,1fr)}#sec-report .report-presets .btn-sm-outline{font-size:11px}}
/* Icon-only controls keep equal sides, including inside shrinking flex rows. */
#appShell .topbar .mobile-more-back,#appShell .topbar .btn-icon,#appShell .topbar button:has(#themeIcon){box-sizing:border-box;flex:0 0 36px!important;width:36px!important;min-width:36px!important;max-width:36px!important;height:36px!important;min-height:36px!important;max-height:36px!important;aspect-ratio:1;padding:0!important;align-items:center;justify-content:center;line-height:1}
#appShell .topbar .mobile-more-back,#appShell .topbar button:has(#themeIcon){border-radius:50%!important}
#appShell .topbar #pushBtn,#appShell .topbar #alertBellBtn{border-radius:9px!important}
#mobileMorePageBack,#messageBack,.message-icon-button{box-sizing:border-box;flex:0 0 44px;width:44px!important;min-width:44px;max-width:44px;height:44px!important;min-height:44px;max-height:44px;aspect-ratio:1;padding:0;display:grid;place-items:center}
.message-tools button,.message-avatar,.message-thread-avatar,.person-avatar{flex-shrink:0;aspect-ratio:1}
.modal-x{box-sizing:border-box;flex:0 0 32px;width:32px;height:32px;min-width:32px;min-height:32px;padding:0;display:grid;place-items:center}
#appShell #invoiceTable th,#appShell #invoiceTable td{vertical-align:middle;text-align:center!important}
#appShell #invoiceTable .badge{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle}
#invoicePrintPreview{position:fixed;inset:0;z-index:15000;display:flex;flex-direction:column;height:var(--tb-app-height,100dvh);background:var(--bg-card);color:var(--fg);overscroll-behavior:none}
.invoice-print-toolbar{display:flex;flex:none;justify-content:space-between;align-items:center;gap:12px;padding:calc(10px + env(safe-area-inset-top,0px)) 16px 10px;border-bottom:1px solid var(--border);background:var(--bg-card)}
.invoice-print-toolbar button{min-height:44px;padding:10px 14px;border:1px solid var(--border);border-radius:8px;font:inherit;font-size:14px;background:var(--bg-input);color:var(--fg);cursor:pointer}
.invoice-print-toolbar button:last-child{background:var(--accent);color:#fff;border-color:var(--accent)}
#invoicePrintPreview iframe{display:block;flex:1 1 0;width:100%;min-height:0;border:0;background:white}
@media(max-width:380px){#appShell .topbar .mobile-more-back,#appShell .topbar .btn-icon,#appShell .topbar button:has(#themeIcon){flex-basis:32px!important;width:32px!important;min-width:32px!important;max-width:32px!important;height:32px!important;min-height:32px!important;max-height:32px!important}}

#appShell .topbar .mobile-more-back{border:1px solid var(--border);background:var(--bg-card);color:var(--accent-text);font-size:26px}

/* Separate message actions into true circular icon buttons. */
#appShell .message-tools{border:0;border-radius:0;background:transparent;box-shadow:none;padding:0;gap:6px}
#appShell .message-tools button{box-sizing:border-box;flex:0 0 40px;width:40px!important;min-width:40px;max-width:40px;height:40px!important;min-height:40px;max-height:40px;padding:0;aspect-ratio:1;border:1px solid var(--border);border-radius:50%;background:var(--bg-card)}

/* Report headers and values share the same cell grid and center lines. */
#appShell #rptTable{width:100%;table-layout:auto;border-collapse:collapse}
#appShell #rptTable>thead>tr>th,#appShell #rptTable>tbody>tr>td{box-sizing:border-box;text-align:center!important;vertical-align:middle!important;padding:14px 16px;border-right:1px solid var(--border);border-bottom:1px solid var(--border);white-space:nowrap;font-variant-numeric:tabular-nums}
#appShell #rptTable>thead>tr>th:last-child,#appShell #rptTable>tbody>tr>td:last-child{border-right:0}

/* Keep page chrome and content aligned across mobile workspaces. */
.toast{
 width:max-content;max-width:calc(100vw - 32px);box-sizing:border-box;
 white-space:normal;overflow-wrap:anywhere;text-align:center;font-size:14px;line-height:1.4;
}
#appShell .card-head{
 flex-wrap:wrap;gap:8px 12px;
}
#appShell .card-head > *,#appShell .staff-acts > *,#appShell .modal-foot > *,
#appShell .mobile-teammate > *{min-width:0;max-width:100%}
#appShell .staff-acts,.modal-foot{flex-wrap:wrap;gap:8px}
#appShell .card-title{font-size:16px;line-height:1.35;overflow-wrap:anywhere}
#appShell .card-meta{font-size:13px;line-height:1.35;overflow-wrap:anywhere}
#appShell .staff-nm,#appShell .mobile-teammate strong,.message-picker-person strong{
 overflow-wrap:anywhere;
}
#appShell #terminalCardBody label{line-height:1.45}
#appShell #terminalCardBody button,#appShell #staffJoinCard button{
 max-width:100%;white-space:normal;overflow-wrap:anywhere;
}
#messagePicker .message-picker-person:disabled .message-picker-marker{visibility:hidden}
#messagePicker .message-picker-person:disabled{cursor:default;color:var(--fg-2)}
@media(max-width:767px){
 #appShell.active{flex-direction:column}
 #appShell.active>.main{height:auto}
 #appShell.active>.main>.content{padding-bottom:16px;scroll-padding-bottom:16px}
 #appShell.active[data-mobile-section=messages]>.main>.content{padding-bottom:12px}
 #appShell.active #mobileTabBar{
  position:relative;inset:auto;flex:0 0 auto;
  margin:6px max(10px,env(safe-area-inset-right,0px)) max(8px,env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-left,0px));
 }
 #appShell.active #mobileTabBar button{font-size:11px;line-height:1.2;white-space:normal;overflow-wrap:anywhere;text-align:center}
 #appShell .topbar #topbarTitle,#appShell .message-toolbar h1,
 #appShell .message-thread-header #msgPaneHead,#appShell .mobile-profile-header h2{
  font-size:20px;font-weight:750;line-height:1.25;letter-spacing:-.02em;overflow-wrap:anywhere;
 }
 #appShell #sec-messages .message-thread-header{gap:8px;align-items:center}
 #appShell .message-thread-header #msgPaneHead{flex:1;padding:9px 0;min-width:0}
 #appShell .topbar .tb-actions{max-width:100%;flex-wrap:wrap}
 #appShell .topbar #addBtn{font-size:14px;line-height:1.25;white-space:normal;min-height:40px}
 #appShell .mobile-profile-header h2{min-width:0}
 #appShell #sec-report .report-presets{grid-template-columns:repeat(2,minmax(0,1fr))}
 #appShell #sec-report .report-presets .btn-sm-outline,
 #appShell #sec-payroll .payroll-hours-actions .btn-icon{
  font-size:13px;line-height:1.25;white-space:normal;overflow-wrap:anywhere;
 }
 #appShell #sec-payroll .payroll-hours-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
 #appShell #sec-payroll .payroll-hours-actions .btn-icon{height:auto;min-height:44px}
 #appShell #invoiceTable th,#appShell #invoiceTable td{font-size:12px}
 #appShell #invoiceTable .badge{font-size:11px;line-height:1.25}
 #appShell #sec-dashboard .st-sub,#appShell #dashWidgetGrid .st-sub{font-size:12px}
 #appShell #dashWidgetGrid .st-trend{
  position:static;display:inline-block;max-width:100%;font-size:11px;line-height:1.25;margin-top:5px;
 }
 #msgList .mti-preview,#appShell .message-thread-meta{line-height:1.35}
 #appShell .message-thread-meta{font-size:12px}
 #appShell #sec-messages .msg-inp{font-size:16px}
 #appShell #sec-messages .btn-send{font-size:14px}
 .toast{bottom:calc(78px + env(safe-area-inset-bottom,0px))}
}
@media(max-width:390px){
 #appShell.active>.main>.topbar:has(#addBtn:not([hidden])){flex-wrap:wrap}
 #appShell .topbar .tb-title-wrap{flex-basis:112px}
}

.mobile-team-actions{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 12px}
.mobile-team-actions button{min-height:44px;white-space:normal;font-size:14px;line-height:1.25}
#sec-staff[data-manage-team] #terminalCard{display:none!important}
#sec-staff[data-manage-team] #staffCard .card-head{display:none}
.staff-empty{margin:0;padding:16px;color:var(--fg-2);font-size:14px}

.message-blocked-label,#messageThreadBlock.message-blocked-label{color:var(--red);font-weight:750}
.message-safety-toolbar{min-height:76px;box-sizing:border-box}
@media(max-width:767px){
 #appShell #sec-messages .message-thread-header{display:grid;grid-template-columns:minmax(75px,1fr) minmax(0,2fr) minmax(75px,1fr);min-height:76px;padding:12px 2px 16px;box-sizing:border-box;gap:6px}
 #appShell .message-thread-header #msgPaneHead{grid-column:2;margin:0;padding:0;text-align:center;font-size:21px;font-weight:750;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 #appShell #messageBack{width:44px;height:44px;border:1px solid var(--border);border-radius:50%;background:var(--bg-card);justify-self:start}
 #appShell #messageThreadBlock{grid-column:3;justify-self:end;margin:0;padding-inline:6px;font-size:12px;white-space:normal}
}
