/* mobile.css — overrides para telemóvel/tablet
   Carregar DEPOIS do default.css
*/

:root{
  --touch-min: 44px;
}

/* ====== Mobile/Tablet gerais ====== */
@media (max-width: 991.98px){

  .container{ padding-left: 14px; padding-right: 14px; }

  /* Evita zoom automático do iOS */
  input, select, textarea, .form-control, .form-select{
    font-size: 16px !important;
  }

  /* Botão "Voltar ao topo" */
  .to-top{
    bottom: calc(var(--footer-height) + 28px + env(safe-area-inset-bottom)) !important;
  }

  .app-footer.open ~ .to-top,
  .app-footer.is-open ~ .to-top{
    bottom: calc(28px + 220px + env(safe-area-inset-bottom)) !important;
  }

  /* ====== Motorista: accordion compacto ====== */
  .motorista-page .accordion-button{ padding: 14px 14px; }

  .motorista-page .accordion-button.collapsed .motorista-hide-collapsed{
    display:none !important;
  }

  .motorista-page .motorista-summary__title{
    font-weight: 700;
    font-size: 18px;
    line-height: 1.15;
  }

  .motorista-page .motorista-summary__sub{
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.25;
    opacity: .9;
  }

  .motorista-page .motorista-summary__rota{
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .motorista-page .motorista-summary__right{ min-width: 98px; }

  .motorista-page .motorista-badge-status{
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 999px;
  }

  .motorista-page .motorista-badge-ox{
    padding: 6px 9px;
    border-radius: 999px;
  }

  .motorista-page .accordion-body{ padding: 14px 14px 16px 14px; }

  .motorista-page hr{ margin: 14px 0; opacity: .15; }

  .motorista-page .motorista-kv .k{
    display:inline-block;
    min-width: 0;
    font-weight: 600;
    opacity: .75;
    margin-right: 6px;
  }

  .motorista-page .motorista-action-buttons{
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .motorista-page .motorista-action-buttons .btn{
    min-height: var(--touch-min);
    font-size: 18px;
    border-radius: 14px;
  }

  .motorista-page textarea.form-control{ border-radius: 14px; }
}

/* ====== Tablet: 2 colunas ====== */
@media (min-width: 520px) and (max-width: 991.98px){
  .motorista-page .motorista-action-buttons{ grid-template-columns: 1fr 1fr; }
  .motorista-page .motorista-action-buttons .btn.btn-primary{ grid-column: 1 / -1; }
}

/* ===== Header mobile ===== */
@media (max-width: 768px){
  #tp-header .container-fluid{
    flex-wrap: wrap !important;
    row-gap: 10px;
  }

  #tp-header .navbar-brand{
    flex: 0 0 100% !important;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
  }

  #tp-header .navbar-brand img{ height: 44px !important; }

  #tp-header .ms-auto{
    flex: 0 0 100% !important;
    margin-left: 0 !important;
    justify-content: flex-end !important;
    gap: 10px !important;
  }

  #tp-header .ms-auto .btn{
    padding: .35rem .65rem !important;
    font-size: .95rem !important;
    border-radius: 12px !important;
    line-height: 1.15 !important;
  }
}



/* V27.3 — motorista: folga entre header e botão Filtros */
.motorista-page .motorista-topbar-gap{
  margin-top: 1.15rem !important;
}
.motorista-page .motorista-topbar-gap .btn[data-bs-target="#filtersCollapse"]{
  margin-top: .15rem !important;
}



/* V27.5 — Gestão de Viaturas: dados Transportadora/Tipo à esquerda e sem coluna de abertura */.viaturas-table .viaturas-open-col{
  display:none !important;
}
.viaturas-table tbody tr.viaturas-row{
  cursor:pointer;
}



/* V27.6 — headers centrados, dados Transportadora/Tipo à esquerda */



/* V27.7 — header centrado e dados alinhados à esquerda */
.viaturas-table th.col-transportadora,
.viaturas-table th.col-tipo{
    text-align:center !important;
}

.viaturas-table tbody td.col-transportadora,
.viaturas-table tbody td.col-tipo{
    text-align:left !important;
    padding-left:18px !important;
}



/* V27.8 — headers centrados; apenas células Transportadora e Tipo à esquerda */
.viaturas-table thead th{
  text-align:center !important;
}
.viaturas-table tbody td.col-transportadora,
.viaturas-table tbody td.col-tipo,
.viaturas-table tbody td.text-start.col-transportadora,
.viaturas-table tbody td.text-start.col-tipo{
  text-align:left !important;
  padding-left:22px !important;
}



/* V27.10 — Motoristas: Nome alinhado à esquerda, headers mantêm centro */
.motorista-nome-left{
    text-align:left !important;
    padding-left:18px !important;
}



/* V27.11 — Motoristas: headers centrados; dados da coluna Nome à esquerda */
.viaturas-table thead th{
  text-align:center !important;
}
.viaturas-table tbody td.motorista-nome-left,
td.motorista-nome-left{
  text-align:left !important;
  padding-left:18px !important;
}


/* V27.13 — botão voltar ao topo acima do footer */
.back-to-top,
.btn-back-top,
#backToTop,
.scroll-top-btn{
    bottom: 110px !important;
}



/* V27.14 — Voltar ao topo no início do footer */
.to-top,
#toTopBtn{
  bottom: 148px !important;
  right: 24px !important;
  z-index: 10050 !important;
}
@media (max-width: 991.98px){
  .to-top,
  #toTopBtn{
    bottom: calc(148px + env(safe-area-inset-bottom)) !important;
  }
}



/* V27.16 — Hierarquia SINAI no novo pedido */
.tnu-sinai-wrap{
  margin-top:.35rem;
}
.tnu-sinai-wrap .form-select{
  min-height:42px;
}
.tnu-sinai-help{
  color:#64748b;
  font-size:.82rem;
}



/* V27.19 — Modal hierárquico SINAI */
.tnu-hier-box{
  margin-top:.25rem;
}
.tnu-hier-trigger{
  width:100%;
  min-height:46px;
  border:1px solid #d7e0ea;
  background:#fff;
  border-radius:12px;
  padding:.55rem .75rem;
  text-align:left;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:.12rem;
  transition:box-shadow .16s ease, border-color .16s ease, transform .16s ease;
}
.tnu-hier-trigger:hover{
  border-color:var(--brand, #059242);
  box-shadow:0 8px 22px rgba(9,111,53,.10);
  transform:translateY(-1px);
}
.tnu-hier-trigger-main{
  color:#0f172a;
  font-weight:700;
  line-height:1.15;
}
.tnu-hier-trigger-sub{
  color:#64748b;
  font-size:.82rem;
  line-height:1.2;
}
.tnu-hier-path{
  margin-top:.45rem;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:.35rem;
  color:#475569;
  font-size:.84rem;
}
.tnu-hier-path span,
.tnu-hier-path strong{
  background:#f8fafc;
  border:1px solid #e2e8f0;
  border-radius:999px;
  padding:.18rem .48rem;
}
.tnu-hier-path strong{
  color:var(--brand-strong, #096f35);
  background:#edf8f1;
  border-color:#bfe7cf;
}
.tnu-hier-clear{
  margin-top:.35rem;
  border:0;
  background:transparent;
  color:#64748b;
  padding:0;
  font-size:.82rem;
}
.tnu-hier-clear:hover{
  color:var(--brand-strong, #096f35);
  text-decoration:underline;
}

.tnu-hier-modal{
  position:fixed;
  inset:0;
  z-index:20000;
}
.tnu-hier-backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.62);
  backdrop-filter:blur(2px);
}
.tnu-hier-dialog{
  position:relative;
  width:min(1120px, calc(100vw - 40px));
  max-height:calc(100vh - 60px);
  margin:30px auto;
  background:#fff;
  border-radius:22px;
  box-shadow:0 28px 80px rgba(2,6,23,.35);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.tnu-hier-head{
  padding:1.15rem 1.35rem;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:1rem;
  background:linear-gradient(90deg,#fff 0%,#fff7df 100%);
  border-bottom:1px solid #e5edf5;
}
.tnu-hier-eyebrow{
  color:var(--brand-strong, #096f35);
  font-size:.76rem;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.08em;
}
.tnu-hier-title{
  margin:0;
  font-weight:800;
  font-size:1.35rem;
  color:#0f172a;
}
.tnu-hier-current{
  margin-top:.2rem;
  color:#64748b;
  font-size:.9rem;
}
.tnu-hier-close{
  border:0;
  background:transparent;
  font-size:1.6rem;
  line-height:1;
  color:#475569;
  width:38px;
  height:38px;
  border-radius:999px;
}
.tnu-hier-close:hover{
  background:#f1f5f9;
  color:#0f172a;
}
.tnu-hier-search-wrap{
  padding:1rem 1.35rem .75rem;
}
.tnu-hier-grid{
  padding:0 1.35rem 1.1rem;
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:1rem;
  min-height:420px;
  overflow:auto;
}
.tnu-hier-col{
  border:1px solid #e2e8f0;
  border-radius:16px;
  overflow:hidden;
  background:#fbfdff;
  display:flex;
  flex-direction:column;
}
.tnu-hier-col-title{
  padding:.8rem .9rem;
  font-weight:800;
  color:#0f172a;
  border-bottom:1px solid #e2e8f0;
  background:#fff;
}
.tnu-hier-list{
  padding:.5rem;
  overflow:auto;
  max-height:390px;
}
.tnu-hier-item{
  width:100%;
  border:1px solid transparent;
  background:transparent;
  border-radius:12px;
  padding:.62rem .7rem;
  text-align:left;
  color:#0f172a;
  font-weight:600;
  line-height:1.25;
  margin-bottom:.25rem;
}
.tnu-hier-item:hover{
  background:#f1f7f4;
  border-color:#cce8d8;
}
.tnu-hier-item.active{
  background:#e8f7ef;
  border-color:#9ed6b7;
  color:var(--brand-strong, #096f35);
}
.tnu-hier-empty{
  color:#64748b;
  padding:1rem;
  font-size:.9rem;
}
.tnu-hier-foot{
  padding:.9rem 1.35rem 1.1rem;
  border-top:1px solid #e5edf5;
  display:flex;
  justify-content:flex-end;
}
body.tnu-hier-modal-open{
  overflow:hidden;
}

@media (max-width: 991.98px){
  .tnu-hier-dialog{
    width:calc(100vw - 20px);
    margin:10px auto;
    max-height:calc(100vh - 20px);
  }
  .tnu-hier-grid{
    grid-template-columns:1fr;
    min-height:auto;
  }
  .tnu-hier-list{
    max-height:230px;
  }
}



/* V27.21 — refinamento modal hierárquico SINAI */
.tnu-hier-dialog{
  width:min(1180px, calc(100vw - 44px)) !important;
  max-height:calc(100vh - 54px) !important;
}
.tnu-hier-grid{
  gap:1.15rem !important;
}
.tnu-hier-col{
  box-shadow:inset 0 1px 0 rgba(255,255,255,.8);
}
.tnu-hier-list{
  scrollbar-width:thin;
}
.tnu-hier-item{
  min-height:42px;
  display:flex;
  align-items:center;
}
.tnu-hier-trigger-main{
  white-space:normal;
}
.tnu-hier-trigger-sub{
  white-space:normal;
}

/* V27.24 — alinhamento premium do modal Hierarquia Clínica */
.tnu-hier-dialog,
.tnu-hier-dialog *{
  font-family:inherit !important;
  letter-spacing:0 !important;
}
.tnu-hier-head{
  padding:1rem 1.25rem !important;
}
.tnu-hier-eyebrow{
  font-size:.68rem !important;
  font-weight:700 !important;
  line-height:1.15 !important;
  letter-spacing:.055em !important;
}
.tnu-hier-title{
  font-size:1.16rem !important;
  font-weight:750 !important;
  line-height:1.15 !important;
}
.tnu-hier-current{
  font-size:.82rem !important;
  line-height:1.25 !important;
}
.tnu-hier-search{
  font-size:.88rem !important;
  line-height:1.35 !important;
  font-weight:400 !important;
  height:42px !important;
}
.tnu-hier-col-title{
  font-size:.88rem !important;
  font-weight:700 !important;
  line-height:1.25 !important;
  padding:.72rem .82rem !important;
}
.tnu-hier-list{
  padding:.42rem !important;
}
.tnu-hier-item{
  height:auto !important;
  min-height:38px !important;
  padding:.56rem .66rem !important;
  align-items:flex-start !important;
  justify-content:flex-start !important;
  font-size:.87rem !important;
  font-weight:500 !important;
  line-height:1.28 !important;
  white-space:normal !important;
  overflow:visible !important;
  word-break:normal !important;
  overflow-wrap:anywhere !important;
}
.tnu-hier-empty{
  font-size:.84rem !important;
  line-height:1.35 !important;
  font-weight:400 !important;
}
.tnu-hier-close{
  font-size:1.35rem !important;
}


/* v7.61 — Motoristas API externa: alinhamento e margem de ações */
.motoristas-table td.motorista-nome-left,.viaturas-table td.motorista-nome-left,td.motorista-nome-left{text-align:left!important;padding-left:1.15rem!important}
.driver-unified-modal .vehicle-modal-footer{padding-right:2rem!important}
.driver-unified-modal .vehicle-footer-right{margin-left:auto!important;margin-right:.65rem!important;padding-right:0!important}
@media (min-width:761px) and (max-width:1180px){.driver-unified-modal .vehicle-modal-footer{padding-right:2.5rem!important}.driver-unified-modal .vehicle-footer-right{margin-right:.85rem!important}}
@media(max-width:760px){.driver-unified-modal .vehicle-modal-footer{padding-right:1.35rem!important}.driver-unified-modal .vehicle-footer-right{margin-right:.25rem!important}}
