/* A.I. COMPANY V5.9.2: final mobile contrast for signed-in roles.
   Last stylesheet: overrides V5.8 selectors without touching desktop.
   Nonfunctional offline preview uses exactly the same rules. */
@media(max-width:700px){
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-month-day{
   background:#173752!important;color:#eaf5ff!important;border:1px solid #446481!important;
   -webkit-text-fill-color:#eaf5ff!important;box-shadow:none!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-month-day.has-job{
   background:#075c9a!important;color:#fff!important;border-color:#299ce9!important;
   -webkit-text-fill-color:#fff!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-month-day.outside{background:#10283e!important;color:#b8cddd!important;opacity:.6!important;}
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] #v59ServiceCalendar :is(.v59-calendar-tabs button,.v59-date-nav button){
   background:#1c405d!important;color:#edf8ff!important;border-color:#426c8c!important;box-shadow:none!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] #v59ServiceCalendar .v59-calendar-tabs button[aria-pressed="true"]{background:#0879df!important;color:#fff!important;border-color:#25a1ff!important;}
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="client"] #clientView :is(.client-contact-link,.client-contact-actions button),
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="employee"] #employeeCompanyInfo .company-info-actions :is(a,button){
   background:#173650!important;color:#f1f8ff!important;border:1px solid #426581!important;
   -webkit-text-fill-color:#f1f8ff!important;box-shadow:none!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="client"] #clientView .client-contact-link:hover,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="client"] #clientView .client-contact-link:focus-visible,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="employee"] #employeeCompanyInfo .company-info-actions a:hover{
   background:#235178!important;color:#fff!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="client"] #clientView :is(.client-contact-card,.client-contact-actions,.client-contact-note){color:#d8eafd!important;}
 html[data-aic-v59-theme="light"] body[data-aic-auth-role="client"] #clientView :is(.client-contact-link,.client-contact-actions button),
 html[data-aic-v59-theme="light"] body[data-aic-auth-role="employee"] #employeeCompanyInfo .company-info-actions :is(a,button){
   background:#f0f6fc!important;color:#173c5c!important;border:1px solid #bed4e8!important;
   -webkit-text-fill-color:#173c5c!important;box-shadow:none!important;
 }
 html[data-aic-v59-theme="light"] body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-month-day{
   background:#eff6fc!important;color:#17446b!important;border:1px solid #c1d9ed!important;
   -webkit-text-fill-color:#17446b!important;
 }
 html[data-aic-v59-theme="light"] body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-month-day.has-job{background:#d4ecff!important;color:#0b4a7a!important;border-color:#42a4ee!important;}
}

/* V5.9.2.3 narrow phone correction: all three roles keep their existing
   calendars and top day/week/month switchers visible, accessible and within
   the viewport. This does not touch data, permissions or desktop. */
@media(max-width:700px){
 body[data-aic-auth-role="admin"] :is(#aicDashCalContent,#dayGrid,#weekGrid,#monthGrid),
 body[data-aic-auth-role="employee"] #v59ServiceCalendar,
 body[data-aic-auth-role="client"] #clientView .client-mini-calendar-card{
  min-width:0!important;max-width:100%!important;box-sizing:border-box!important;
 }
 body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-calendar-tabs,
 body[data-aic-auth-role="client"] #clientView .client-cal-tabs,
 body[data-aic-auth-role="admin"] :is(.aic-dash-calendar-modes,.aic-cal-mode-tabs){
  display:flex!important;flex-wrap:wrap!important;gap:6px!important;
  max-width:100%!important;min-width:0!important;
 }
 body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-calendar-tabs button,
 body[data-aic-auth-role="client"] #clientView :is(#clientTabDay,#clientTabWeek,#clientTabMonth){
  min-width:0!important;flex:1 1 auto!important;touch-action:manipulation;
 }
 body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-date-nav,
 body[data-aic-auth-role="client"] #clientView .client-cal-toolbar{
  min-width:0!important;max-width:100%!important;box-sizing:border-box!important;
 }
 body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-calendar-month{
  width:100%!important;min-width:0!important;grid-template-columns:repeat(7,minmax(0,1fr))!important;
 }
 body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-month-day{
  min-width:0!important;overflow:hidden;text-overflow:ellipsis;
 }
}

/* V5.9.2.4: real mobile calendar selectors (the dashboard uses
   .aic-dash-cal-tabs, not .aic-cal-mode-tabs). Presentation only. */
@media(max-width:700px){
 body[data-aic-auth-role="admin"] #aicDashboardPanel .aic-dash-calendar-head{
  display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:8px!important;
  width:100%!important;min-width:0!important;
 }
 body[data-aic-auth-role="admin"] #aicDashboardPanel .aic-dash-cal-tabs,
 body[data-aic-auth-role="client"] #clientView .client-cal-tabs,
 body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-calendar-tabs{
  position:static!important;top:auto!important;transform:none!important;
  display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:6px!important;width:100%!important;max-width:100%!important;min-width:0!important;
  padding:4px 0!important;box-shadow:none!important;
 }
 body[data-aic-auth-role="admin"] #aicDashboardPanel .aic-dash-cal-tabs button,
 body[data-aic-auth-role="client"] #clientView .client-cal-tabs button,
 body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-calendar-tabs button{
  min-width:0!important;min-height:42px!important;padding:8px 4px!important;
  font-size:12px!important;line-height:1.15!important;touch-action:manipulation!important;
  box-sizing:border-box!important;
 }
 body[data-aic-auth-role="admin"] #aicDashboardPanel :is(.aic-dash-calendar-nav,.aic-dash-cal-grid,.aic-dash-calendar-content),
 body[data-aic-auth-role="client"] #clientView :is(.client-cal-toolbar,.client-mini-month,.client-cal-list),
 body[data-aic-auth-role="employee"] #v59ServiceCalendar :is(.v59-date-nav,.v59-calendar-month,.v59-cal-content){
  box-sizing:border-box!important;min-width:0!important;max-width:100%!important;
 }
 body[data-aic-auth-role="admin"] #aicDashboardPanel .aic-dash-cal-grid,
 body[data-aic-auth-role="client"] #clientView .client-mini-month,
 body[data-aic-auth-role="employee"] #v59ServiceCalendar .v59-calendar-month{
  grid-template-columns:repeat(7,minmax(0,1fr))!important;
 }
 body[data-aic-auth-role="admin"] #aicDashboardPanel .aic-dash-cal-day{
  min-width:0!important;overflow:hidden!important;
 }
 body[data-aic-auth-role="admin"] #aicDashboardPanel .aic-dash-month-event{
  min-width:0!important;max-width:100%!important;overflow:hidden!important;
 }
 body[data-aic-auth-role="admin"] #aicDashboardPanel .aic-dash-month-event>span:nth-child(2){
  min-width:0!important;max-width:100%!important;white-space:nowrap!important;
  overflow:hidden!important;text-overflow:ellipsis!important;
 }
 body[data-aic-auth-role="admin"] #aicDashboardPanel,
 body[data-aic-auth-role="client"] #clientView .client-mini-calendar-card,
 body[data-aic-auth-role="employee"] #v59ServiceCalendar{
  box-sizing:border-box!important;width:100%!important;max-width:100%!important;
  overflow-wrap:anywhere!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="admin"] #aicDashboardPanel .aic-dash-cal-tabs{
  background:#112940!important;
 }
 html[data-aic-v59-theme="light"] body[data-aic-auth-role="admin"] #aicDashboardPanel .aic-dash-cal-tabs{
  background:#fff!important;
 }
}
@media(max-width:700px){
 body[data-aic-auth-role="admin"] #aicDashboardPanel .aic-dash-calendar-head button:focus-visible,
 body[data-aic-auth-role="employee"] #v59ServiceCalendar button:focus-visible,
 body[data-aic-auth-role="client"] #clientView .client-cal-tabs button:focus-visible{
  outline:2px solid #46a8fa!important;outline-offset:2px!important;
 }
 .v59-drop-target{outline:3px solid #309efb!important;outline-offset:-3px!important;}
}

@media(max-width:700px){
 body[data-aic-auth-role] .v59-theme-toggle{
  width:36px!important;min-width:36px!important;max-width:36px!important;
  padding:5px!important;flex:0 0 36px!important;
 }
 body[data-aic-auth-role] .v59-theme-toggle svg{
  width:20px!important;height:20px!important;flex:0 0 20px!important;
 }
}

/* V5.9.2.6: prevent the role panels from being cut off on short/narrow phones.
   Layout only. Never change sessions, PUSH, messaging or calendar actions. */
@media (max-width:1099px){
  html:has(body[data-aic-auth-role]),
  html:has(body[data-aic-auth-role]) body{
    height:auto!important;min-height:100%!important;max-height:none!important;
    overflow-y:auto!important;overflow-x:clip!important;
    -webkit-overflow-scrolling:touch;
  }
  body[data-aic-auth-role] .phone{
    position:relative!important;height:auto!important;min-height:100dvh!important;
    max-height:none!important;overflow:visible!important;
    padding-bottom:calc(85px + env(safe-area-inset-bottom,0px))!important;
  }
  body[data-aic-auth-role] .phone>.content{
    height:auto!important;max-height:none!important;min-height:0!important;
    overflow-y:visible!important;overflow-x:clip!important;
    padding-bottom:calc(110px + env(safe-area-inset-bottom,0px))!important;
  }
  body[data-aic-auth-role] #employeeView,
  body[data-aic-auth-role] #employeeTodayPanel,
  body[data-aic-auth-role] #clientView,
  body[data-aic-auth-role] #clientHistoryPanel,
  body[data-aic-auth-role] #adminView{
    height:auto!important;max-height:none!important;min-height:0!important;
    overflow-y:visible!important;box-sizing:border-box!important;
  }
  body[data-aic-auth-role] .phone>.content :is(.card,.v59-list-card,.v59-service-calendar,.client-mini-calendar-card){
    max-width:100%!important;min-width:0!important;box-sizing:border-box!important;
  }
}

/* V5.9.2.6: Service dark-mode actions must not stay white on a dark panel. */
@media(max-width:700px){
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="employee"] #employeeView :is(.client-refresh-btn,.client-logout-btn,.employee-message-shortcut),
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="employee"] #employeeView :is(.client-auth-card,.employee-messages-card) button:not(.push-enable-btn):not(.client-send-btn):not(.client-login-btn),
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="employee"] #employeeProfileTab{
  background:#1d405c!important;color:#eaf5ff!important;-webkit-text-fill-color:#eaf5ff!important;
  border:1px solid #4a7492!important;box-shadow:none!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="employee"] #employeeView :is(.client-refresh-btn,.client-logout-btn,.employee-message-shortcut):focus-visible{
  outline:2px solid #46b7ff!important;outline-offset:2px!important;
 }
}

/* V5.9.2.6b: mobile brand + dark-theme consistency. VISUAL ONLY.
   No Google/PUSH/tenant/backend/calendar operation is modified. */
@media (max-width:700px){
 /* Footer identifies the software owner. Never show the generic product
    label in a signed-in role header; show the actual tenant's name as soon
    as the company settings are loaded. No change to tenant logos or footer. */
 html body[data-aic-auth-role].aic-v59-mobile-generic-brand
      .phone>.hero #appCompanyBrandName{display:none!important;}
 /* Fix isolated legacy white buttons inside dark ROLE cards. Keep action
    buttons, success chips, active tabs and disabled state semantics intact. */
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content :is(
     .client-refresh-btn,.client-logout-btn,.admin-refresh-btn,.admin-logout-btn,
     .employee-clear-btn,.company-info-actions a,.company-info-actions button,
     .client-contact-link,.client-contact-actions button,
     .admin-messages-card .client-refresh-btn,.client-messages-card .client-refresh-btn,
     .client-history-toolbar button,#clientHistoryMore,.admin-workspace .week-nav
   ){
    background:#1b3a56!important;
    color:#eff8ff!important;
    -webkit-text-fill-color:#eff8ff!important;
    border:1px solid #466c8d!important;
    box-shadow:none!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content
   :is(.client-refresh-btn,.client-logout-btn,.admin-refresh-btn,.admin-logout-btn,
       .employee-clear-btn,.client-contact-link,.company-info-actions button,.company-info-actions a):focus-visible{
    outline:2px solid #66b9ff!important;outline-offset:2px!important;
 }
 /* Existing white backgrounds in the ADMIN mobile calendar/cards come from
    legacy #id selectors with !important. Override at the same narrow viewport. */
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="admin"] #adminView :is(
    .admin-auth-card,.admin-jobs-live,.admin-workspace-left,.admin-workspace-right,
    .aic-dashboard-box,.aic-dash-calendar-box,.aic-dash-calendar-head,
    .aic-dash-calendar-content,.day-detail-card,.aic-dash-jobs-box,
    .company-settings-card,.admin-messages-card
   ){
    background:#112940!important;color:#edf7ff!important;
    border-color:#345979!important;box-shadow:none!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="admin"]
   #aicDashboardPanel .aic-dash-cal-day{
    background:#193852!important;color:#eaf7ff!important;
    border-color:#426482!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="admin"]
   #aicDashboardPanel .aic-dash-cal-day.today{
    background:#1b4a74!important;border-color:#389fe7!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="admin"]
   #aicDashboardPanel :is(.aic-dash-month-event,.aic-dash-month-event>span,
     .aic-dash-calendar-head h3,.aic-dash-day-entry,.aic-dash-day-entry span){
    color:#e5f3ff!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="admin"]
   #adminView :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){
    background:#102b43!important;color:#edf8ff!important;
    -webkit-text-fill-color:#edf8ff!important;
    border-color:#496f90!important;color-scheme:dark!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="admin"]
   #adminView :is(input,textarea)::placeholder{color:#adcadf!important;opacity:1!important;}
 /* Authenticated CLIENT and SERWIS had bright refresh/logout buttons within
    the dark account box; these use the same non-CTA palette above. */
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content
   :is(.client-auth-card,.admin-auth-card,.client-next-card,.client-messages-card,
       .company-info-card,.client-mini-calendar-card,.v59-service-calendar){
    background:#112940!important;color:#edf7ff!important;
    border-color:#345979!important;
 }
 /* Light mode is deliberately unchanged. */
}
