/*
 * Atlas shared interaction system — ONE backoffice, all sectors.
 * Reuses brand-neutral Atlas UI; marketing landing pages are intentionally unaffected.
 * Consistent 44px targets, matching heights and equal action widths, including iOS Safari.
 */
#appShell{
  --atlas-control-height:44px;
  --atlas-control-radius:11px;
  --atlas-action-gap:9px;
}
#appShell :is(.btn,.opsBtn,a.btn,button.btn){
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  vertical-align:middle;
  min-height:var(--atlas-control-height);
  height:auto;
  max-width:100%;
  padding:10px 14px !important;
  border-radius:var(--atlas-control-radius);
  font-size:13px !important;
  line-height:1.3;
  font-weight:700;
  text-align:center;
  white-space:normal;
  overflow-wrap:anywhere;
  text-decoration:none;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
#appShell :is(.btn,.opsBtn,a.btn,button.btn):focus-visible,
#appShell button:focus-visible,
#appShell select:focus-visible{
  outline:3px solid #4cb8a7;
  outline-offset:2px;
}
/* Pair or group adjacent actions with identical widths and baseline. */
#appShell :is(
  .opsActions,
  .opsQuickActions,
  .opsWidgetControls,
  .opsMessageActions,
  .atlasClientVehicleActions,
  .atlasConsentActions,
  .atlasSeatMemberTools
){
  gap:var(--atlas-action-gap);
}
#appShell :is(.opsActions,.opsQuickActions,.opsWidgetControls,.opsMessageActions,.atlasClientVehicleActions,.atlasConsentActions)
  > :is(.btn,.opsBtn,a.btn,button.btn){
  flex:1 1 110px;
  min-width:0;
}
#appShell .opsMessageActions{
  display:inline-flex;
  flex-wrap:wrap;
  width:min(100%,420px);
  align-items:stretch;
}
#appShell .opsMessageActions > :is(.btn,.opsBtn,a.btn,button.btn){
  flex:1 1 95px;
}
/* Avoid varying vertical heights where form cards have both select and buttons. */
#appShell :is(.opsForm,.stack,.formgrid) :is(button.btn,a.btn,.opsBtn){
  min-height:var(--atlas-control-height);
}
#appShell :is(.opsForm,.stack,.formgrid,.opsAgendaFilters) :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]),
  select
){
  min-height:var(--atlas-control-height);
  box-sizing:border-box;
}
/* Agenda navigation has a distinct compact shape, but an identical tap target. */
#appShell .opsAgendaViewTabs button,
#appShell .opsAgendaPeriod > button,
#appShell .opsAgendaToday,
#appShell .opsNewBooking{
  min-height:var(--atlas-control-height);
}
#appShell .opsAgendaPeriod > button:not(.opsAgendaToday){
  width:44px;
  height:44px;
  flex:none;
}
#appShell .opsAgendaViewTabs{max-width:100%;min-width:0}
#appShell .opsAgendaViewTabs button{min-width:0;box-sizing:border-box}
/* Tiny controls remain visually compact but are safe to touch on mobile. */
@media(max-width:740px){
  #appShell{--atlas-control-height:44px;--atlas-action-gap:8px}
  #appShell :is(
    .opsActions,
    .opsQuickActions,
    .opsWidgetControls,
    .atlasClientVehicleActions,
    .atlasConsentActions
  ){display:flex;align-items:stretch;flex-wrap:wrap}
  #appShell :is(
    .opsActions,
    .opsQuickActions,
    .opsWidgetControls,
    .atlasClientVehicleActions,
    .atlasConsentActions
  ) > :is(.btn,.opsBtn,a.btn,button.btn){
    flex:1 1 calc(50% - 8px);
    min-width:min(108px,100%);
  }
  #appShell .opsMessageActions{width:100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
  #appShell .opsMessageActions > :is(.btn,.opsBtn,a.btn,button.btn){
    width:100%;min-width:0;padding-inline:6px !important;
  }
  #appShell .opsAgendaTopRow{
    align-items:stretch;
    min-width:0;
  }
  #appShell .opsAgendaViewTabs{
    width:100%;
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:4px;
  }
  #appShell .opsAgendaViewTabs button{
    width:100%;min-height:44px;padding:10px 5px;
  }
  #appShell .opsNewBooking{width:100%}
  #appShell .opsAgendaFilters{
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:12px;
  }
  #appShell .opsAgendaFilters .field{width:100%;min-width:0;max-width:100%}
  #appShell .opsAgendaFilters :is(input[type="date"],select){
    width:100%;min-width:0;max-width:100%;font-size:16px;
  }
  #appShell .atlasSeatMemberTools{align-items:stretch}
  #appShell .atlasSeatMemberTools > :is(button.btn,.opsBtn){width:100%}
  #appShell .opsAppointment .opsActions>.btn{min-height:44px}
  #appShell .opsOrderActions button,
  #appShell .atlasMobileDrawerTitle button{
    min-width:44px;min-height:44px;
  }
  #appShell .atlasDetailBar button{min-width:44px;min-height:44px}
}
@media(max-width:360px){
  #appShell .opsMessageActions{grid-template-columns:repeat(2,minmax(0,1fr))}
  #appShell .opsActions > :is(.btn,.opsBtn,a.btn,button.btn){flex-basis:100%}
}


/* Cartão de lista partilhado (A.listCard em atlas-core.js): Clientes, Viaturas, Pedidos,
   Dashboard, Retenção e Avaliações. O nome abre a ficha, o ícone do canto apaga ou
   dispensa, e os contactos ficam numa barra de botões com a mesma largura. */
#appShell .atlasListCard{padding:14px 0;border-bottom:1px solid #e6edf0;min-width:0}
#appShell .atlasListCard:last-child{border-bottom:0}
#appShell .opsWidgets .atlasListCard.opsDashboardRow{display:block!important;overflow:visible;padding:14px 0!important}
#appShell .atlasListBody{
  display:grid;grid-template-columns:auto minmax(0,1fr) auto;
  grid-template-areas:"sel main corner" "acts acts acts";
  align-items:start;column-gap:10px;row-gap:10px
}
#appShell .atlasListBody.atlasListNoSelect{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"main corner" "acts acts"}
#appShell .atlasListSelect{grid-area:sel;display:flex;padding-top:2px}
#appShell .atlasListSelect input[type=checkbox]{width:20px;height:20px;min-height:20px;margin:0;accent-color:#117f73}
#appShell .atlasListMain{grid-area:main;min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:4px}
#appShell .atlasListMain>.muted{margin:0!important;font-size:13px;line-height:1.4;overflow-wrap:anywhere}
#appShell .atlasListCorner{grid-area:corner;display:flex;margin:-6px 0 0}
/* Listas de cartões: sem caixa de scroll interna (a página faz scroll) e sem cortes. */
#appShell .opsList.atlasCardList,#appShell .opsList:has(>.atlasListCard){max-height:none;overflow:visible;margin-top:8px}
#appShell .atlasActionBar{grid-area:acts;min-width:0}
#appShell .atlasNameLink,#appShell .atlasListName{
  display:inline-flex;align-items:center;gap:3px;max-width:100%;min-height:28px;margin:0;padding:0;
  border:0;background:none;font:inherit;font-size:16px;font-weight:700;line-height:1.3;color:#1b3547;text-align:left
}
#appShell .atlasNameLink{cursor:pointer;border-radius:6px}
#appShell .atlasNameLink>span{min-width:0;overflow-wrap:anywhere}
#appShell .atlasNameLink .atlasNameChevron{flex:none;color:#117f73;transition:transform .15s}
#appShell .atlasNameLink:hover{color:#117f73}
#appShell .atlasNameLink:hover .atlasNameChevron{transform:translateX(2px)}
#appShell .atlasCornerBtn{
  display:flex;align-items:center;justify-content:center;flex:none;
  width:44px;height:44px;min-height:44px;padding:0!important;border-radius:12px;cursor:pointer
}
#appShell .atlasCornerBtn.atlasCornerDismiss{border:1px solid #dde6ea!important;background:#f6f9fa!important;color:#5f7482!important}
#appShell .atlasCornerBtn.atlasCornerDismiss:hover{background:#eaf0f3!important;color:#1b3547!important}
/* Barra de contactos: colunas iguais, ícone por cima do texto. */
#appShell .atlasListCard .atlasListBody .atlasActionBar{
  display:grid!important;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);
  grid-template-columns:none;gap:6px!important;width:100%;align-items:stretch;flex:none;margin:0
}
#appShell .atlasListCard .atlasListBody .atlasActionBar .opsMessageActions{display:contents!important}
#appShell .atlasListCard .atlasListBody .atlasActionBar :is(.btn,.opsBtn,a.btn){
  display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:4px;
  width:100%!important;min-width:0!important;min-height:54px!important;margin:0;flex:none!important;
  padding:7px 4px!important;font-size:11px!important;line-height:1.1;white-space:nowrap;text-decoration:none;
  overflow:hidden;text-overflow:ellipsis
}
#appShell .atlasListCard .atlasListBody .atlasActionBar :is(.btn,.opsBtn,a.btn)::before{
  content:"";width:18px;height:18px;flex:none;background:currentColor;
  -webkit-mask:var(--atlas-action-icon) center/contain no-repeat;mask:var(--atlas-action-icon) center/contain no-repeat
}
#appShell .atlasListCard .atlasListBody .atlasActionBar :is(.btn,.opsBtn,a.btn):not([data-message-channel],[data-action-icon],[data-wa-contact])::before{display:none}
#appShell .atlasListCard .atlasListBody .atlasActionBar :is([data-message-channel="whatsapp"],[data-action-icon="whatsapp"],[data-wa-contact]){--atlas-action-icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 11.5a8.5 8.5 0 0 1-12.6 7.4L3 21l2.1-5.3A8.5 8.5 0 1 1 21 11.5z%22/%3E%3C/svg%3E")}
#appShell .atlasListCard .atlasListBody .atlasActionBar :is([data-message-channel="sms"],[data-action-icon="sms"]){--atlas-action-icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z%22/%3E%3Cpath d=%22M8 9h8M8 13h5%22/%3E%3C/svg%3E")}
#appShell .atlasListCard .atlasListBody .atlasActionBar :is([data-message-channel="email"],[data-action-icon="email"]){--atlas-action-icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Crect x=%223%22 y=%225%22 width=%2218%22 height=%2214%22 rx=%222%22/%3E%3Cpath d=%22m3 7 9 6 9-6%22/%3E%3C/svg%3E")}
/* Pedidos: o estado passa para debaixo do nome e o caixote fica no canto. */
#appShell .opsRequestHead .opsRequestIdentity{flex:1}
#appShell .opsRequestIdentity .opsRequestStatus{justify-self:start}
#appShell .opsRequestHead>.atlasCornerBtn{margin:-4px 0 0}
#appShell .opsRequestFooter .atlasActionBar{flex:1 1 100%}
#appShell .opsRequestCard .opsRequestFooter .atlasActionBar :is(.btn,a.btn){
  display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:4px;
  width:100%!important;min-width:0!important;min-height:54px!important;margin:0;flex:none!important;
  padding:7px 4px!important;font-size:11px!important;line-height:1.1;white-space:nowrap;text-decoration:none
}
#appShell .opsRequestCard .opsRequestFooter .atlasActionBar{display:grid!important;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:6px!important;width:100%}
#appShell .opsRequestCard .opsRequestFooter .atlasActionBar .opsMessageActions{display:contents!important}
#appShell .opsRequestCard .opsRequestFooter .atlasActionBar :is(.btn,a.btn)::before{
  content:"";width:18px;height:18px;flex:none;background:currentColor;
  -webkit-mask:var(--atlas-action-icon) center/contain no-repeat;mask:var(--atlas-action-icon) center/contain no-repeat
}
#appShell .opsRequestCard .opsRequestFooter .atlasActionBar :is([data-message-channel="whatsapp"],[data-action-icon="whatsapp"],[data-wa-contact]){--atlas-action-icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 11.5a8.5 8.5 0 0 1-12.6 7.4L3 21l2.1-5.3A8.5 8.5 0 1 1 21 11.5z%22/%3E%3C/svg%3E")}
#appShell .opsRequestCard .opsRequestFooter .atlasActionBar :is([data-message-channel="sms"],[data-action-icon="sms"]){--atlas-action-icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z%22/%3E%3Cpath d=%22M8 9h8M8 13h5%22/%3E%3C/svg%3E")}
#appShell .opsRequestCard .opsRequestFooter .atlasActionBar :is([data-message-channel="email"],[data-action-icon="email"]){--atlas-action-icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Crect x=%223%22 y=%225%22 width=%2218%22 height=%2214%22 rx=%222%22/%3E%3Cpath d=%22m3 7 9 6 9-6%22/%3E%3C/svg%3E")}
/* No computador, os contactos ficam ao lado do nome e o canto no fim
   (exceto nos widgets do Dashboard, que são estreitos). */
@media(min-width:1101px){
  #appShell :not(.opsWidgets *)>.atlasListCard>.atlasListBody{grid-template-columns:auto minmax(160px,1fr) minmax(200px,460px) auto;grid-template-areas:"sel main acts corner";align-items:center}
  #appShell :not(.opsWidgets *)>.atlasListCard>.atlasListBody.atlasListNoSelect{grid-template-columns:minmax(160px,1fr) minmax(200px,460px) auto;grid-template-areas:"main acts corner"}
  #appShell :not(.opsWidgets *)>.atlasListCard>.atlasListBody>.atlasListCorner{margin:0}
  #appShell :not(.opsWidgets *)>.atlasListCard>.atlasListBody>.atlasActionBar :is(.btn,.opsBtn,a.btn){flex-direction:row!important;gap:6px;min-height:44px!important;font-size:12px!important}
}
@media(max-width:420px){
  #appShell .atlasListCard .atlasListBody .atlasActionBar,#appShell .opsRequestCard .opsRequestFooter .atlasActionBar{gap:4px!important}
  #appShell .atlasListCard .atlasListBody .atlasActionBar :is(.btn,.opsBtn,a.btn),#appShell .opsRequestCard .opsRequestFooter .atlasActionBar :is(.btn,a.btn){font-size:10px!important;padding-left:1px!important;padding-right:1px!important;letter-spacing:-.2px}
}
@media(max-width:365px){
  #appShell .atlasListCard .atlasListBody .atlasActionBar :is(.btn,.opsBtn,a.btn),#appShell .opsRequestCard .opsRequestFooter .atlasActionBar :is(.btn,a.btn){font-size:9px!important;letter-spacing:-.25px}
}
/* Ficha de cliente: barra de contactos no topo (Ligar, WhatsApp, SMS, Email). */
#appShell .atlasClientContactBar{
  display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:8px;width:100%;margin:2px 0 14px
}
#appShell .atlasClientContactBar .opsMessageActions{display:contents!important}
#appShell .atlasClientContactBar :is(.btn,.opsBtn,a.btn){
  display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:5px;
  width:100%!important;min-width:0!important;min-height:60px!important;margin:0;flex:none!important;
  padding:8px 4px!important;font-size:12px!important;line-height:1.1;white-space:nowrap;text-decoration:none
}
#appShell .atlasClientContactBar :is(.btn,.opsBtn,a.btn)::before{
  content:"";width:20px;height:20px;flex:none;background:currentColor;
  -webkit-mask:var(--atlas-action-icon) center/contain no-repeat;mask:var(--atlas-action-icon) center/contain no-repeat
}
#appShell .atlasClientContactBar [data-action-icon="call"]{background:#127a6c!important;border-color:#127a6c!important;color:#fff!important}
#appShell .atlasClientContactBar [data-action-icon="call"].active{background:#0d5f54!important}
#appShell .atlasClientContactBar [data-message-channel="whatsapp"]{--atlas-action-icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 11.5a8.5 8.5 0 0 1-12.6 7.4L3 21l2.1-5.3A8.5 8.5 0 1 1 21 11.5z%22/%3E%3C/svg%3E")}
#appShell .atlasClientContactBar [data-message-channel="sms"]{--atlas-action-icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z%22/%3E%3Cpath d=%22M8 9h8M8 13h5%22/%3E%3C/svg%3E")}
#appShell .atlasClientContactBar [data-message-channel="email"]{--atlas-action-icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Crect x=%223%22 y=%225%22 width=%2218%22 height=%2214%22 rx=%222%22/%3E%3Cpath d=%22m3 7 9 6 9-6%22/%3E%3C/svg%3E")}
#appShell [data-action-icon="call"]{--atlas-action-icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2z%22/%3E%3C/svg%3E")}
#appShell .atlasCallPanel{border:1px solid #cfe5e0;background:#f2f9f7;border-radius:14px;padding:14px 16px;margin:-4px 0 16px;display:grid;gap:10px}
#appShell .atlasCallPanel[hidden]{display:none}
#appShell .atlasCallPanel small{display:block;color:#5b6b78;font-size:12px}
#appShell .atlasCallPanel strong{font-size:22px;letter-spacing:.3px;color:#13293a}
#appShell .atlasCallPanelActions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
#appShell .atlasCallPanelActions :is(.btn,a.btn){text-align:center;text-decoration:none;justify-content:center}
#appShell .atlasCallPanel p{margin:0;font-size:12px}
@media(max-width:420px){#appShell .atlasClientContactBar{gap:6px}#appShell .atlasClientContactBar :is(.btn,.opsBtn,a.btn){font-size:11px!important;min-height:56px!important}}
/* Ficha de cliente: próxima marcação. */
#appShell .atlasNextAppt{border:1px solid #dfe7ec;border-left:4px solid #127a6c;border-radius:14px;background:#fff;padding:14px 16px;margin:0 0 16px;display:grid;gap:6px}
#appShell .atlasNextAppt.isEmpty{border-left-color:#c8d3da;display:flex;align-items:center;justify-content:space-between;gap:12px}
#appShell .atlasNextApptHead{display:flex;align-items:center;justify-content:space-between;gap:8px}
#appShell .atlasNextAppt small{color:#5b6b78;font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.5px}
#appShell .atlasNextApptWhen{font-size:18px;color:#13293a}
#appShell .atlasNextApptWhat{margin:0;color:#3d4f5c;font-size:14px}
#appShell .atlasNextApptStatus{font-size:12px;font-weight:600;padding:3px 9px;border-radius:999px;background:#e6f4f1;color:#0f6b5e}
#appShell .atlasNextApptStatus:is(.is-pending,.is-requested){background:#fff4dd;color:#8a5a00}
#appShell .atlasNextApptActions{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:8px;margin-top:6px}
#appShell .atlasNextAppt.isEmpty .atlasNextApptActions{margin:0;grid-auto-columns:auto}
#appShell .atlasNextApptActions .atlasNextApptPrimary{background:#127a6c!important;border-color:#127a6c!important;color:#fff!important}
#appShell .atlasNextApptMore summary{cursor:pointer;color:#127a6c;font-size:13px;font-weight:600;margin-top:4px}
#appShell .atlasNextApptRow{display:flex;justify-content:space-between;width:100%;border:0;border-top:1px solid #eef2f4;background:none;padding:8px 2px;font:inherit;font-size:13px;color:#13293a;cursor:pointer;text-align:left}
