/* Phone/tablet layout only. Keep desktop and printed documents unchanged. */
@media screen and (max-width:800px){
 .content{padding:18px 14px calc(110px + env(safe-area-inset-bottom));scroll-padding-bottom:110px}
 .content .table-shell:has(> .mobile-record-table),
 .content .crm-table-scroll:has(> .mobile-record-table){max-height:none!important;height:auto!important;overflow:visible!important;isolation:auto;background:transparent;border:0}
 .content .mobile-record-table{position:static;overflow:visible}
 .content .mobile-record-table tbody{width:100%;overflow:visible}
 .content .mobile-record-table tbody tr{height:auto;min-height:0;overflow:visible;margin:12px 0;padding:14px}
 .content .mobile-record-table tbody td{position:static!important;display:block;float:none;height:auto;overflow:visible!important;line-height:1.5}
 .content .mobile-record-table tbody td:before{display:block;margin-bottom:5px}
 .content .mobile-record-table td .actions{display:flex;flex-wrap:wrap;gap:8px}
 .content .mobile-record-table td .btn{margin:4px 4px 4px 0;white-space:normal;min-height:44px}
 .topbar,.topbar:has(.topright>.user-info){position:relative;top:auto;display:grid;grid-template-columns:44px minmax(0,1fr);height:auto;gap:8px;padding:10px 14px;min-width:0}
 .topbar>.searchbox{grid-column:2;min-width:0;width:100%;overflow:hidden;border-radius:12px;background:#ffffff06;padding:0 10px;gap:8px}
 .topbar .searchbox input{width:100%;min-width:0;text-overflow:ellipsis;font-size:16px!important;padding-inline:0}
 .topbar>.topright,.topbar:has(.topright>.user-info)>.topright{grid-column:1/-1;display:flex;flex-wrap:wrap;align-items:center;gap:8px;width:100%;min-width:0}
 .topright>[data-do="staffViewPicker"],.topright>[data-do="exitStaffView"]{margin-right:auto;flex:1 1 150px;min-height:44px;font-size:13px;padding:10px 12px}
 .topright>.iconbtn,.topright>[data-fullscreen]{flex:0 0 44px;width:44px;min-width:44px;height:44px;min-height:44px;padding:10px}
 .topright>.avatar{display:none}
 .mobile-quick-nav{padding-top:6px;padding-bottom:calc(6px + env(safe-area-inset-bottom));border-radius:18px 18px 0 0}
 .mobile-quick-nav button{font-size:11px;min-height:46px;gap:3px}
 .content[data-mobile-page="team"]>.page-head{gap:14px;margin-bottom:16px}
 .content[data-mobile-page="team"] .page-head h1{font-size:25px;line-height:1.2;margin-bottom:0}
 .content[data-mobile-page="team"] .page-head>.actions{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.3fr);width:100%;max-width:100%;gap:8px}
 .content[data-mobile-page="team"] .page-head>.actions>*{min-width:0;width:100%;margin:0;font-size:14px;min-height:44px}
 .content[data-mobile-page="team"]>.tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible;gap:6px;padding:0;margin-bottom:18px}
 .content[data-mobile-page="team"]>.tabs .tab{min-width:0;white-space:normal;text-align:center;justify-content:center;min-height:44px;padding:9px 8px;font-size:13px;line-height:1.35;display:flex;align-items:center;gap:6px}
 .content[data-mobile-page="team"] .tab-count{flex-shrink:0;margin:0}
 .content[data-mobile-page="team"] .mobile-record-table tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 16px;padding:16px;border:1px solid #89b5f12b;border-radius:16px;background:linear-gradient(135deg,#1c3049,#13213a)}
 .content[data-mobile-page="team"] .mobile-record-table tbody td{padding:0!important;grid-column:1/-1;min-width:0;font-size:15px}
 .content[data-mobile-page="team"] .mobile-record-table td[data-mobile-label="Employee"]{order:0;font-size:18px;font-weight:650;padding-bottom:10px!important;border-bottom:1px solid #89b5f12b!important}
 .content[data-mobile-page="team"] .mobile-record-table td[data-mobile-label="Dates"]{order:1}
 .content[data-mobile-page="team"] .mobile-record-table td[data-mobile-label="Type"]{order:2;grid-column:1}
 .content[data-mobile-page="team"] .mobile-record-table td[data-mobile-label="Status"]{order:3;grid-column:2}
 .content[data-mobile-page="team"] .mobile-record-table td[data-mobile-label="Reason"]{order:4}
 .content[data-mobile-page="team"] .mobile-record-table td[data-mobile-label="Action"],
 .content[data-mobile-page="team"] .mobile-record-table td[data-mobile-label="Actions"]{order:10;display:flex;flex-wrap:wrap;gap:8px;padding-top:12px!important;border-top:1px solid #89b5f12b!important}
 .content[data-mobile-page="team"] .mobile-record-table td[data-mobile-label="Action"]:before,
 .content[data-mobile-page="team"] .mobile-record-table td[data-mobile-label="Actions"]:before{flex-basis:100%;margin:0}
 .content[data-mobile-page="team"] .mobile-record-table td .btn{flex:1 1 120px;margin:0;font-size:14px;padding:11px 12px}
 .content[data-mobile-page="team"] .mobile-record-table .mobile-empty-row{display:block}
}

/* Keep native iPhone date/month controls inside attendance cards. */
@media screen and (max-width:800px){
 .content .attendance-report-tools,.content .daily-punch-register{box-sizing:border-box;min-width:0;max-width:100%}
 .content .attendance-report-actions,.content .attendance-filterbar{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;width:100%;min-width:0;max-width:100%;box-sizing:border-box}
 .content .attendance-report-actions>label,.content .attendance-filterbar>label{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;width:100%;min-width:0;max-width:100%;box-sizing:border-box}
 .content .attendance-report-actions input,.content .attendance-filterbar input,.content .attendance-filterbar select{display:block;box-sizing:border-box;width:100%;inline-size:100%;min-width:0;min-inline-size:0;max-width:100%;max-inline-size:100%;min-height:46px;margin:0;font-size:16px!important}
 .content .attendance-report-actions input[type="month"],.content .attendance-filterbar input[type="date"]{-webkit-appearance:none;appearance:none;overflow:hidden}
 .content .attendance-report-actions input::-webkit-date-and-time-value,.content .attendance-filterbar input::-webkit-date-and-time-value{min-width:0;text-align:left}
 .content .attendance-report-actions>.btn{width:100%;min-width:0;max-width:100%;min-height:46px;margin:0;white-space:normal;box-sizing:border-box}
 .content .daily-punch-register>.panel-head,.content .attendance-day-heading{flex-wrap:wrap;gap:12px}
 .content .daily-punch-register>.panel-head>div,.content .attendance-day-heading>div{min-width:0;max-width:100%}
 .content .daily-punch-register .daily-punch-grid{grid-template-columns:minmax(0,1fr);min-width:0}
 .content .daily-punch-register .daily-punch-card{min-width:0;max-width:100%;box-sizing:border-box}
}

/* Dedicated mobile refresh slot, separate from the action row. */
@media screen and (max-width:800px){
 .topbar:has(>.mobile-refresh-button),.topbar:has(.topright>.user-info):has(>.mobile-refresh-button){grid-template-columns:44px minmax(0,1fr) 44px}
 .topbar>.mobile-refresh-button{grid-column:3;grid-row:1}
 .topbar>.mobile-menu{grid-column:1;grid-row:1}
 .topbar>.searchbox{grid-row:1}
 .topbar>.mobile-refresh-button,.mcb-head>.mobile-refresh-button{width:44px!important;min-width:44px!important;max-width:44px!important;height:44px!important;padding:0!important;gap:0;flex:0 0 44px;align-self:center;box-sizing:border-box}
 .mobile-refresh-button>span{display:none!important}
 .mobile-refresh-button>svg{width:20px;height:20px;margin:0;display:block}
}

/* Keep navigation labels above the home indicator in the installed app. */
@media screen and (max-width:800px){
 .mobile-quick-nav{bottom:12px;bottom:max(12px,env(safe-area-inset-bottom,0px));left:8px;right:8px;padding:8px;border-radius:18px;border:1px solid #7daaff38}
 .content{padding-bottom:calc(122px + env(safe-area-inset-bottom,0px));scroll-padding-bottom:calc(122px + env(safe-area-inset-bottom,0px))}
}
