/* A.I. COMPANY V5.9 — LOCAL INTEGRATION, MOBILE PRESENTATION ONLY.
   No changes to Supabase, PUSH, Service Workers, Google or desktop layouts.
   Protected content remains controlled by V5.8 Auth and RLS gates.
*/
@media (max-width:700px){
  html[data-aic-v59-theme="dark"] body[data-aic-auth-role],
  html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone,
  html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content{
    background:#071725!important;color:#eaf4ff!important;color-scheme:dark;
  }
  body[data-aic-auth-role] .phone{max-width:100%!important;overflow-x:clip!important;box-shadow:none!important;padding-bottom:78px!important;}
  body[data-aic-auth-role] .phone>.hero{
    padding:12px 12px 11px!important;background:linear-gradient(125deg,#071827,#102d4b)!important;
    border-radius:0!important;border-bottom:1px solid #264764!important;color:#f6fbff!important;
    box-shadow:none!important;position:relative!important;top:auto!important;z-index:6!important;
  }
  body[data-aic-auth-role] .phone>.hero .toprow{display:flex!important;align-items:center!important;gap:7px!important;min-width:0!important;}
  body[data-aic-auth-role] .phone>.hero .brand{display:flex!important;flex:1 1 auto!important;min-width:0!important;align-items:center!important;gap:9px!important;}
  body[data-aic-auth-role] .phone>.hero .logo-mark{width:39px!important;height:39px!important;flex:0 0 39px!important;border-radius:10px!important;}
  body[data-aic-auth-role] .phone>.hero .brand-name{font-size:17px!important;line-height:1.2!important;color:#fff!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
  body[data-aic-auth-role] .phone>.hero .brand-sub{color:#aec5dd!important;font-size:10px!important;}
  body[data-aic-auth-role] .phone>.hero #adminHead,
  body[data-aic-auth-role] .phone>.hero #employeeHead,
  body[data-aic-auth-role] .phone>.hero #clientHead{display:none!important;}
  body[data-aic-auth-role] .phone>.hero .role-tabs{display:none!important;}
  body[data-aic-auth-role] .phone>.hero #appHomeBtn{width:31px!important;height:33px!important;min-height:0!important;min-width:0!important;padding:0!important;overflow:hidden!important;font-size:0!important;}
  body[data-aic-auth-role] .phone>.hero #appHomeBtn:after{content:'⌂';font-size:23px;line-height:33px;color:#eaf5ff;}
  body[data-aic-auth-role] .phone>.hero .lang-flag-btn{min-width:29px!important;width:29px!important;height:33px!important;padding:0!important;}
  body[data-aic-auth-role] .phone>.hero .ai-company-desktop-nav{
    display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr))!important;gap:2px!important;
    margin:12px 0 0!important;padding:12px 0 0!important;border-top:1px solid #23425d!important;
    width:100%!important;min-width:0!important;max-width:100%!important;overflow:visible!important;
    background:transparent!important;box-shadow:none!important;
  }
  body[data-aic-auth-role] .phone>.hero .ai-sidebar-link[data-role]{
    display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;
    min-width:0!important;max-width:100%!important;min-height:58px!important;padding:6px 1px!important;
    margin:0!important;border:0!important;border-radius:10px!important;box-shadow:none!important;
    background:transparent!important;color:#cee0f1!important;gap:5px!important;
    font-size:9px!important;font-weight:750!important;line-height:1.05!important;text-align:center!important;white-space:normal!important;
  }
  body[data-aic-auth-role] .phone>.hero .ai-sidebar-link[data-role] .ai-nav-icon{display:grid!important;place-items:center!important;flex:0 0 23px!important;width:23px!important;height:23px!important;color:inherit!important;}
  body[data-aic-auth-role] .phone>.hero .ai-sidebar-link[data-role] .ai-nav-icon svg{width:22px!important;height:22px!important;}
  body[data-aic-auth-role] .phone>.hero .ai-sidebar-link[data-role]>span:nth-child(2){font-size:9px!important;line-height:1.12!important;color:inherit!important;text-align:center!important;overflow-wrap:anywhere!important;white-space:normal!important;}
  body[data-aic-auth-role] .phone>.hero .ai-sidebar-link[data-aic-active="true"]{
    background:linear-gradient(150deg,#099ffe,#0b60d7)!important;color:#fff!important;
    box-shadow:0 5px 12px #0469db45!important;
  }
  body[data-aic-auth-role="employee"] .phone>.hero .ai-company-desktop-nav,
  body[data-aic-auth-role="client"] .phone>.hero .ai-company-desktop-nav{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
  body:not([data-aic-auth-role="admin"]) .phone>.hero .ai-sidebar-link[data-role="admin"],
  body:not([data-aic-auth-role="employee"]) .phone>.hero .ai-sidebar-link[data-role="employee"],
  body:not([data-aic-auth-role="client"]) .phone>.hero .ai-sidebar-link[data-role="client"]{display:none!important;}
  body[data-aic-auth-role] .phone>.content{padding:12px 10px 90px!important;min-width:0!important;overflow-x:clip!important;}
  body[data-aic-auth-role] .phone>.content section,
  body[data-aic-auth-role] .phone>.content .card,
  body[data-aic-auth-role] .phone>.content .client-dashboard-grid,
  body[data-aic-auth-role] .phone>.content .admin-workspace,
  body[data-aic-auth-role] .phone>.content .admin-workspace-left,
  body[data-aic-auth-role] .phone>.content .admin-workspace-right{min-width:0!important;max-width:100%!important;}
  body[data-aic-auth-role] #adminView #adminTodayPanel:not(.hidden),
  body[data-aic-auth-role] #clientView .client-dashboard-grid{display:block!important;max-width:100%!important;}
  body[data-aic-auth-role] #adminView #adminTodayPanel .admin-workspace{display:block!important;}
  body[data-aic-auth-role] #adminView #adminTodayPanel .admin-workspace-left,
  body[data-aic-auth-role] #adminView #adminTodayPanel .admin-workspace-right{width:100%!important;max-width:100%!important;margin:0 0 12px!important;position:static!important;top:auto!important;}
  body[data-aic-auth-role] #clientView .client-right-stack{display:grid!important;grid-template-columns:minmax(0,1fr)!important;}
  body[data-aic-auth-role] .phone>.bottom{background:#081a2a!important;border-top:1px solid #31516f!important;}
  body[data-aic-auth-role] .phone>.bottom button{color:#e9f6ff!important;}
  /* PUSH controls remain visible; the redundant consent suffix is removed in index.html. */
  /* Compact day agenda: no hourly placeholders. */
  body[data-aic-auth-role] #dayGrid{display:grid!important;gap:8px!important;}
  body[data-aic-auth-role] #dayGrid .day-detail-card{min-height:0!important;padding:11px!important;}
  body[data-aic-auth-role] .v59-theme-toggle{height:33px;min-height:33px;min-width:72px;border:1px solid #385e7c;border-radius:10px;color:#fff;background:#173751;display:flex;align-items:center;justify-content:center;gap:4px;cursor:pointer;padding:3px 5px;flex:0 0 auto;font-size:10px;font-weight:750;line-height:1;}
  body[data-aic-auth-role] .v59-theme-toggle svg{width:17px;height:17px;flex:0 0 17px;display:block;}
  body[data-aic-auth-role] .v59-theme-toggle span{font-size:10px;white-space:nowrap;letter-spacing:0;}
  body[data-aic-auth-role] .v59-theme-toggle:focus-visible{outline:2px solid #69bbff;outline-offset:2px;}
  body[data-aic-auth-role] .v59-list-card{border:1px solid #31526f;border-radius:16px;background:#10263d;padding:11px;color:#f0f8ff;}
  body[data-aic-auth-role] .v59-list-card h3{font-size:16px;line-height:1.3;margin:0 0 9px;color:#f2faff;}
  body[data-aic-auth-role] .v59-list-item{padding:10px;border:1px solid #294b68;border-left:4px solid #189dff;border-radius:10px;background:#132d47;margin:6px 0;font-size:12px;display:flex;gap:8px;align-items:center;min-width:0;}
  body[data-aic-auth-role] .v59-list-item b{font-size:13px;white-space:normal;overflow-wrap:anywhere;}
  body[data-aic-auth-role] .v59-list-item small{font-size:11px;color:#c0d8e9;display:block;margin-top:2px;}
  body[data-aic-auth-role] .v59-list-empty{color:#b9d4e9;font-size:12px;padding:8px 2px;}
  body[data-aic-auth-role] .v59-service-calendar{margin:0 0 14px!important;max-width:100%!important;}
  body[data-aic-auth-role] .v59-calendar-controls{display:grid;grid-template-columns:1fr;gap:9px;}
  body[data-aic-auth-role] .v59-calendar-tabs{display:flex;gap:5px;justify-content:center;}
  body[data-aic-auth-role] .v59-calendar-tabs button{background:#203a55;color:#e0f0ff;border:1px solid #41607d;border-radius:9px;padding:7px 10px;font-size:12px;font-weight:700;cursor:pointer;}
  body[data-aic-auth-role] .v59-calendar-tabs button[aria-pressed="true"]{background:#087ee8;color:#fff;}
  body[data-aic-auth-role] .v59-date-nav{display:grid;grid-template-columns:34px minmax(0,1fr) 34px;gap:6px;align-items:center;text-align:center;font-size:13px;}
  body[data-aic-auth-role] .v59-date-nav button{background:#1b3955;color:#e6f3ff;border:1px solid #315977;border-radius:9px;height:34px;cursor:pointer;}
  body[data-aic-auth-role] .v59-cal-content{margin-top:11px;}
  body[data-aic-auth-role] .v59-calendar-month{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;}
  body[data-aic-auth-role] .v59-calendar-month .v59-month-day{min-height:42px;text-align:center;border:1px solid #284b69;border-radius:7px;padding:6px 2px;color:#daeaff;font-size:11px;}
  body[data-aic-auth-role] .v59-calendar-month .v59-month-day[aria-current="date"]{border-color:#299efa;}
  body[data-aic-auth-role] .v59-calendar-month .v59-month-day.has-job{background:#0c4979;color:#fff;}
  body[data-aic-auth-role] .v59-private-note{font-size:11px;color:#a1c1df;}
}
@media(max-width:380px){body[data-aic-auth-role] .phone>.hero .ai-sidebar-link[data-role]>span:nth-child(2){font-size:8px!important;}}
@media(min-width:701px){.v59-theme-toggle,.v59-service-calendar{display:none!important;}}
/* Light mode changes only the mobile palette, not the data or permissions. */
@media(max-width:700px){
  html[data-aic-v59-theme="light"] body[data-aic-auth-role] .phone>.hero{background:#e8f2fc!important;color:#122c47!important;border-color:#c1d7ed!important;}
  html[data-aic-v59-theme="light"] body[data-aic-auth-role] .phone>.hero .brand-name{color:#122c47!important;}
  html[data-aic-v59-theme="light"] body[data-aic-auth-role] .phone>.hero .brand-sub{color:#46617b!important;}
  html[data-aic-v59-theme="light"] body[data-aic-auth-role] .phone>.hero .ai-sidebar-link[data-role]:not([data-aic-active="true"]){color:#244b6c!important;}
  html[data-aic-v59-theme="light"] body[data-aic-auth-role] .v59-theme-toggle{background:#fff;color:#163d61;border-color:#abc9e5;}
  html[data-aic-v59-theme="light"] body[data-aic-auth-role] .phone>.content{background:#eef4fa!important;color:#18344f!important;}
  html[data-aic-v59-theme="light"] body[data-aic-auth-role] .v59-list-card{background:#fff;color:#18344f;border-color:#d0e1f1;}
  html[data-aic-v59-theme="light"] body[data-aic-auth-role] .v59-list-card h3{color:#143653;}
  html[data-aic-v59-theme="light"] body[data-aic-auth-role] .v59-private-note{color:#53728f;}
  html[data-aic-v59-theme="light"] body[data-aic-auth-role] .v59-list-item{background:#f1f7fc;border-color:#cadcf0;border-left-color:#168ce5;color:#143653;}
  html[data-aic-v59-theme="light"] body[data-aic-auth-role] .v59-list-item small{color:#51728c;}
}
@media(max-width:700px){
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .card,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .stat,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .client-auth-card,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .company-info-card,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .client-mini-calendar-card,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .client-next-card,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .client-contact-card,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .client-messages-card,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .admin-auth-card,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .admin-jobs-live,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .admin-workspace-right,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .company-settings-card,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .aic-dashboard-box,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content #clientHistoryPanel{
    background:#112940!important;color:#e9f5ff!important;border:1px solid #315575!important;
    box-shadow:none!important;border-radius:14px!important;
 }
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content h2,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content h3,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .section-title h2,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .client-card-head h3,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .admin-jobs-live h3,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .aic-dashboard-box h3{color:#f1f8ff!important;}
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .stat small,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .stat b{color:#e5f4ff!important;}
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .job-top .name,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .client-cal-item .nm{color:#e9f6ff!important;}
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .client-cal-item,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .client-mini-day,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role] .phone>.content .day-detail-card{background:#173650!important;color:#e4f3ff!important;border-color:#355b79!important;}
 body[data-aic-auth-role] .phone>.content .client-cal-list-compact,
 body[data-aic-auth-role] .phone>.content .client-dashboard-grid,
 body[data-aic-auth-role] .phone>.content #jobs,
 body[data-aic-auth-role] .phone>.content .client-messages-card{min-width:0!important;overflow-wrap:anywhere!important;}
 body[data-aic-auth-role] .phone>.content #clientCalendarList,
 body[data-aic-auth-role] .phone>.content #employeeMessagesList{max-width:100%!important;min-width:0!important;overflow-x:hidden!important;}
}
/* Brand size only on public desktop landing, as previously approved. */
@media(min-width:701px){#splash .ai-public-brand{font-size:17px!important;}#splash .ai-public-mark{width:36px!important;height:36px!important;}}
/* Compatibility with stronger legacy V5.8 theme selectors, limited to signed-in phone UI. */
@media(max-width:700px){
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="admin"] .phone>.content #aicDashboardPanel,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="admin"] .phone>.content #adminTodayPanel:has(#aicDashboardPanel){background:#071725!important;color:#eaf4ff!important;border:0!important;box-shadow:none!important;padding:0!important;}
 body[data-aic-auth-role] .phone>.hero .ai-sidebar-link[data-aic-active="true"],
 body[data-aic-auth-role] .phone>.hero .ai-sidebar-link[aria-current="page"]{
  background:linear-gradient(145deg,#0ca3ff,#0866df)!important;color:#fff!important;
  box-shadow:0 4px 11px #0752a64f!important;
 }
 body[data-aic-auth-role="employee"] #employeeView{display:flex!important;flex-direction:column;gap:11px;}
 body[data-aic-auth-role="employee"] #employeeView .client-auth-card{order:0;}
 body[data-aic-auth-role="employee"] #employeeView #employeeTodayPanel{order:1;}
 body[data-aic-auth-role="employee"] #employeeView #employeeCompanyCard{order:2;}
 body[data-aic-auth-role="employee"] #employeeView #employeeMessages{order:3;}
 body[data-aic-auth-role="employee"] #employeeView #employeeHistoryPanel{order:4;}
 body[data-aic-auth-role="employee"][data-aic-service-view="today"] #employeeView #employeeMessages,
 body[data-aic-auth-role="employee"][data-aic-service-view="today"] #employeeView #employeeHistoryPanel{display:none!important;}
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="client"] .phone>.content .client-cal-tabs button,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="client"] .phone>.content .client-cal-toolbar button{background:#183754!important;color:#eaf6ff!important;border:1px solid #3c5e7b!important;border-radius:9px!important;}
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="client"] .phone>.content .client-cal-tabs button.active{background:#087ee6!important;color:#fff!important;border-color:#219cfb!important;}
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="client"] .phone>.content .client-cal-toolbar b{color:#ecf8ff!important;}
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="client"] .phone>.content .client-cal-item .dt{color:#c8dff2!important;}
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="client"] .phone>.content .client-mini-weekday,
 html[data-aic-v59-theme="dark"] body[data-aic-auth-role="client"] .phone>.content .client-mini-day{color:#d8ebfa!important;}
}
@media(max-width:700px){
 html body[data-aic-auth-role="admin"] .phone>.hero .ai-company-desktop-nav .ai-sidebar-link[data-role="admin"][data-aic-active="true"],
 html body[data-aic-auth-role="employee"] .phone>.hero .ai-company-desktop-nav .ai-sidebar-link[data-role="employee"][data-aic-active="true"],
 html body[data-aic-auth-role="client"] .phone>.hero .ai-company-desktop-nav .ai-sidebar-link[data-role="client"][data-aic-active="true"]{
  background:linear-gradient(150deg,#099ffe,#0b60d7)!important;color:#fff!important;border-color:transparent!important;
 }
}

