/* Tablet layouts use CSS viewport widths, including iPad Split View. */
@media (min-width:761px) and (max-width:1366px){
 .content{padding:24px 22px 40px}
 .page-heading{gap:14px;flex-wrap:wrap}.page-heading>.row-controls{max-width:100%;flex-wrap:wrap}
 .package-tier-cards{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.package-tier-cards button{padding:14px 10px;min-width:0}.package-tier-cards button>span{font-size:.85rem}
 .house-task-tabs,.tier-tabs{overflow-x:auto;flex-wrap:nowrap;gap:18px}.house-task-tabs button,.tier-tabs button{flex-shrink:0;min-height:44px}
 button,input:not([type="checkbox"]):not([type="radio"]),select{min-height:44px}
 .icon-button,.inline-edit,.slot-handle,.chat-link,.date-picker-control{min-width:44px!important;min-height:44px!important;height:auto!important;width:auto!important}
 .date-picker-control{width:44px!important;min-height:0!important;height:auto!important}
 .secondary-actions summary{min-height:44px}.prepare-assignment button{min-height:44px}
 .table-wrap{overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin}
 .table-wrap[data-list-view] td{white-space:normal;overflow-wrap:anywhere}
 .table-wrap[data-list-view] td .actions,.row-controls{flex-wrap:wrap}
 .next-work-actions{min-width:165px}.next-work-button{min-height:44px!important;height:auto!important;width:auto!important;justify-content:center}
 #content .table-wrap.compact-list .next-work-button .button-tip,#content .table-wrap.compact-list .renew-package-button .button-tip{display:inline;white-space:normal}
 #content .table-wrap.compact-list .next-work-actions{max-width:none;align-items:center;flex-direction:row;flex-wrap:wrap;gap:10px}
 #content .table-wrap.compact-list .next-work-actions .secondary-actions{margin:0}
 #content .table-wrap.compact-list tbody tr{padding:14px;gap:8px 12px}
 #content .table-wrap.compact-list tbody td{font-size:.85rem}
 #content .table-wrap.compact-list td:nth-child(2)>.sub{font-size:.76rem}
 .v3-filters .field{flex:1 1 180px}.v3-filters>.search-suggest{max-width:none;flex:1 1 320px}
 .prepare-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.prepare-card{padding:18px}
 dialog:not(.v5-calendar-dialog){width:calc(100vw - 48px);max-width:900px;max-height:calc(100dvh - 48px);overflow:auto;overscroll-behavior:contain}
 .modal-head,.modal-content{padding:22px}.modal-head button{min-width:44px}
 .modal-content .form-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:0 18px}
 .modal-content .form-foot{position:sticky;bottom:0;padding:16px 0;background:#fff;z-index:2;flex-wrap:wrap}
 .modal-content .form-foot button{min-height:46px}
 .modal-content .table-wrap{max-width:100%;max-height:55dvh}
 dialog.v5-calendar-dialog{width:400px;max-width:calc(100vw - 48px)}.calendar-days button{min-height:44px}.v5-calendar-dialog header button{min-width:44px;min-height:44px}.calendar-month{grid-template-columns:44px minmax(0,1fr) 83px 44px}
 .order-entry-routing{grid-template-columns:repeat(2,minmax(0,1fr))}.order-entry-routing>.field:last-child:nth-child(3){grid-column:1/-1}
 .topbar{min-height:64px;height:auto;padding:10px 22px;gap:12px;flex-wrap:wrap}.topbar-right{gap:10px}
 .bulk-bar{top:64px}.house-date-group>summary{top:64px}
}
@media (min-width:761px) and (max-width:1024px){
 .shell,.shell.sidebar-compact{display:block}
 .sidebar,.sidebar-compact .sidebar{display:none;position:fixed;inset:0 auto 0 0;z-index:901;width:320px;height:100dvh;max-height:100dvh;padding:22px 16px;border:0;border-radius:0 20px 20px 0;box-shadow:12px 0 48px #18233924;overflow-y:auto;overscroll-behavior:contain;background:#fff}
 .sidebar.open,.sidebar-compact .sidebar.open{display:flex}
 .sidebar .sidebar-brand-row{justify-content:space-between;flex-wrap:nowrap}
 .sidebar .brand,.sidebar-compact .brand{font-size:1.4rem;gap:8px}.sidebar .brand span,.sidebar .brand-sub,.sidebar .nav-label,.sidebar .nav-section-label,.sidebar .sidebar-bottom strong,.sidebar .user-role{display:block}
 .sidebar .nav button{justify-content:flex-start;min-height:48px;padding:12px;text-align:left;gap:12px;border-radius:12px;width:100%}
 .sidebar .nav-label{display:flex;align-items:center;flex:1;gap:8px}.sidebar .house-task-count{margin-left:auto}
 .sidebar-toggle{display:none}.mobile-nav-close{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:0;border:0;background:#f2f7ff;color:#5270a4;border-radius:12px;font-size:1.5rem}
 .mobile-menu{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:10px;border:0;border-radius:12px;background:#f2f7ff;color:#274877}
 .topbar>div:first-child{display:flex;align-items:center;gap:12px;min-width:0}.topbar>div:first-child>.muted{display:none}
 .topbar #crumb{font-weight:600;color:#274877;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .topbar-date{display:none}.button-display-control{display:none}
 .mobile-nav-backdrop{position:fixed;inset:0 0 0 320px;z-index:900;width:calc(100vw - 320px);height:100dvh;border:0;border-radius:0;padding:0;background:#16335c45;backdrop-filter:blur(3px)}
 .shell:has(.sidebar.open) .mobile-nav-backdrop{display:block}body:has(.sidebar.open){overflow:hidden}
 .sidebar-bottom{margin-top:24px;padding:18px 12px}.sidebar-bottom button{width:auto}
 .stats{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-two{grid-template-columns:minmax(0,1fr)}
}
@media (min-width:761px) and (max-width:820px){
 .package-tier-cards{grid-template-columns:repeat(3,minmax(0,1fr))}
 .modal-content .form-grid{grid-template-columns:1fr}.order-entry-routing{grid-template-columns:repeat(2,minmax(0,1fr))}
 .modal-content .form-foot button{flex:1}
}

/* Consistent package actions on desktop, tablet and small screens. */
#content .next-work-actions{display:flex;flex-direction:column;align-items:stretch;gap:8px;min-width:220px;max-width:260px}
#content .package-primary-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;width:100%}
#content .package-primary-actions>:only-child{grid-column:1/-1}
#content .package-primary-actions button{display:inline-flex;justify-content:center;align-items:center;gap:7px;width:100%;height:auto;min-height:42px;padding:10px 8px;font-size:.78rem;line-height:1.4;white-space:normal;border-radius:9px}
#content .package-primary-actions .button-tip{display:block;position:static;transform:none;background:none;color:inherit;padding:0;opacity:1;visibility:visible;font-size:inherit;line-height:inherit;width:auto;text-align:center;max-width:none}
#content .next-work-actions .secondary-actions{width:100%;max-width:none;margin:0}
#content .secondary-actions summary{display:flex;align-items:center;justify-content:center;gap:7px;min-height:36px;padding:6px 12px;border:1px solid #e1e8f3;border-radius:9px;background:#fff;color:#7284a0;font-size:.75rem;list-style:none;cursor:pointer}
#content .secondary-actions summary::-webkit-details-marker{display:none}
#content .secondary-actions summary:before{content:'•••';font-size:.85rem}
#content .secondary-actions[open] summary{background:#f4f8ff;color:#3b5cd5}
#content .secondary-actions[open]>.row-controls{display:flex;flex-direction:column;align-items:stretch;gap:0;background:#fff;border:1px solid #dce6f2;border-radius:10px;padding:4px;margin-top:5px;box-shadow:0 4px 12px #18396009}
#content .secondary-actions .row-controls button,#content .secondary-actions .chat-link{display:flex;align-items:center;justify-content:flex-start;gap:9px;width:100%;height:auto;min-height:40px;border:0;border-radius:7px;padding:9px 10px;background:#fff;font-size:.77rem;text-decoration:none}
#content .secondary-actions .row-controls button:hover,#content .secondary-actions .chat-link:hover{background:#f1f6ff}
#content .secondary-actions .button-tip{display:block;position:static;transform:none;background:none;color:inherit;padding:0;opacity:1;visibility:visible;width:auto;max-width:none;font-size:inherit;text-align:left}
@media(max-width:1180px){#content .table-wrap.compact-list .next-work-actions{flex-direction:column;align-items:stretch;width:100%;min-width:0;max-width:none;gap:8px}#content .table-wrap.compact-list .package-primary-actions button{width:100%;height:auto;min-height:44px;padding:10px;font-size:.8rem}#content .table-wrap.compact-list .package-primary-actions .button-tip{display:block}#content .table-wrap.compact-list .secondary-actions .row-controls button{width:100%;height:auto;min-height:42px}#content .table-wrap.compact-list .secondary-actions .button-tip{display:block}}

.renewal-notice-summary{display:block;color:#8291a7;font-size:.72rem;line-height:1.7}.renewal-notice-summary.sent{color:#27816b}

#content .secondary-actions[open]>.row-controls{position:fixed;z-index:15;max-height:calc(100dvh - 24px);overflow:auto;margin:0;box-shadow:0 8px 28px #18396022}

/* Inline labels are content, so they must not inherit tooltip stacking. */
html:not([data-button-display="icons"]) .icon-button .button-tip,
#content .package-primary-actions .button-tip,
#content .secondary-actions .button-tip{z-index:auto;isolation:auto}
#content .secondary-actions[open]>.row-controls{z-index:30}
#content .secondary-actions .row-controls button{min-width:0;gap:9px;line-height:1.5;overflow-wrap:anywhere;white-space:normal}
#content .secondary-actions .button-tip{flex:1;min-width:0;line-height:1.5}
#content .package-primary-actions .button-tip{min-width:0;overflow-wrap:anywhere}

/* Compact action toolbar: content-sized buttons, no full-row blocks. */
#content .next-work-actions,#content .table-wrap.compact-list .next-work-actions{flex-direction:row;align-items:center;justify-content:flex-start;flex-wrap:wrap;gap:6px;min-width:0;max-width:340px;width:auto}
#content .package-primary-actions{display:flex;flex-wrap:wrap;gap:6px;width:auto;max-width:100%}
#content .package-primary-actions button,#content .table-wrap.compact-list .package-primary-actions button{width:auto!important;min-height:34px!important;height:auto!important;padding:7px 10px;font-size:.75rem;gap:6px;line-height:1.4}
#content .next-work-actions .secondary-actions,#content .table-wrap.compact-list .next-work-actions .secondary-actions{width:auto;flex:0 0 auto;margin:0}
#content .secondary-actions summary{min-height:34px;padding:6px 9px;font-size:.72rem;gap:5px}
#content .renewal-notice-summary{flex:1 0 100%;margin-top:0;font-size:.68rem;line-height:1.5}
#content .package-primary-actions .minimal-icon{width:16px;height:16px}
@media(max-width:1180px){#content .table-wrap.compact-list .next-work-actions{max-width:none}#content .table-wrap.compact-list .next-work-actions .secondary-actions{width:auto}}
@media(max-width:760px){#content .package-primary-actions button,#content .table-wrap.compact-list .package-primary-actions button{min-height:38px!important;padding:8px 10px}#content .secondary-actions summary{min-height:38px}}
