:root{font-family:Arial,sans-serif;color:#172033;background:#f4f6f9}*{box-sizing:border-box}body{margin:0}header{background:#172033;color:white;padding:14px 3%;display:flex;gap:24px;align-items:center;flex-wrap:wrap}header nav{margin-left:auto;display:flex;gap:14px}header a{color:white;text-decoration:none}main{padding:28px 3%;max-width:1400px;margin:auto}.narrow{max-width:650px}.card{background:white;padding:22px;border-radius:12px;box-shadow:0 2px 12px #0001;margin-bottom:22px}.grid,.grid4{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:14px}.grid4{margin-bottom:22px}.stat{background:white;padding:24px;border-radius:12px}.stat b{font-size:34px;display:block}.stat span{color:#667}.danger{border-left:5px solid #c62828}.warn{border-left:5px solid #ef8c00}label{display:flex;flex-direction:column;gap:6px;font-weight:bold}input,select,textarea{padding:10px;border:1px solid #ccd2dc;border-radius:7px}.btn{display:inline-block;background:#1f66d1;color:white;border:0;padding:11px 16px;border-radius:8px;text-decoration:none;cursor:pointer}.ok,.err{padding:12px;border-radius:7px;margin:12px 0}.ok{background:#dff6e5;color:#176b2f}.err{background:#ffe2e2;color:#9d1b1b}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:10px;border-bottom:1px solid #e5e7eb}.badge{padding:4px 7px;border-radius:5px}.valido{background:#dff6e5}.a_terminar{background:#fff0c7}.caducado{background:#ffe2e2}.sem_validade{background:#e8ebef}footer{text-align:center;padding:25px;color:#667}@media(max-width:700px){table{display:block;overflow:auto}}.secondary{background:#687386}.danger-btn{background:#bd2525}.small{padding:7px 10px;font-size:13px}.actions{display:flex;gap:6px;align-items:center;white-space:nowrap}.actions form{margin:0}.table-wrap{overflow-x:auto}small{font-weight:normal;color:#667}
.select-with-action{display:flex;gap:7px;align-items:stretch}.select-with-action select{flex:1;min-width:0}.title-manage-btn{display:flex;align-items:center;justify-content:center;min-width:44px;padding:10px 12px;font-weight:bold;font-size:16px;line-height:1}
.modal-overlay{position:fixed;inset:0;background:rgba(15,23,42,.62);display:none;align-items:center;justify-content:center;padding:18px;z-index:9999}.modal-overlay.open{display:flex}.modal-window{background:#fff;border-radius:12px;box-shadow:0 24px 70px rgba(0,0,0,.3);width:min(96vw,1100px);max-height:94vh;display:flex;flex-direction:column;overflow:hidden}.modal-header{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid #e5e7eb}.modal-header h2{margin:0}.modal-close{border:0;background:transparent;font-size:30px;line-height:1;cursor:pointer;color:#475569}.modal-iframe{width:100%;height:78vh;border:0;background:#f4f6f9}.modal-open{overflow:hidden}.modal-page{background:#f4f6f9}.modal-page main{padding:18px;max-width:none}.modal-page h1{margin-top:0}.modal-page footer,.modal-page header{display:none}@media(max-width:700px){.modal-overlay{padding:0}.modal-window{width:100vw;height:100vh;max-height:none;border-radius:0}.modal-iframe{height:calc(100vh - 60px)}}

/* ===== Menu desktop + menu inferior para smartphone ===== */
.desktop-header{
  background:#172033;
  color:#fff;
  min-height:68px;
  padding:10px 3%;
  display:flex;
  align-items:center;
  gap:20px;
  flex-wrap:nowrap;
}
.header-brand{display:flex;align-items:center;gap:14px;min-width:0}
.header-logo{display:block;width:auto;height:46px;max-width:190px;object-fit:contain}
.header-company{font-size:14px;color:#d7dfeb;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:280px}
.desktop-nav{margin-left:auto;display:flex;align-items:center;gap:6px}
.desktop-nav a{display:block;color:#fff;text-decoration:none;padding:10px 11px;border-radius:8px;white-space:nowrap}
.desktop-nav a:hover,.desktop-nav a.active{background:rgba(255,255,255,.14)}
.mobile-bottom-nav{display:none}

@media (max-width:820px){
  .desktop-header{min-height:58px;padding:7px 12px;justify-content:center}
  .header-brand{width:100%;justify-content:center}
  .header-logo{height:40px;max-width:170px}
  .header-company{display:none}
  .desktop-nav{display:none!important}

  body{padding-bottom:calc(72px + env(safe-area-inset-bottom))}
  main{padding:16px 12px 24px}

  .mobile-bottom-nav{
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    z-index:10000;
    display:flex;
    align-items:stretch;
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    background:#172033;
    border-top:1px solid rgba(255,255,255,.14);
    box-shadow:0 -5px 20px rgba(0,0,0,.22);
    padding-bottom:env(safe-area-inset-bottom);
    scrollbar-width:none;
  }
  .mobile-bottom-nav::-webkit-scrollbar{display:none}
  .mobile-bottom-nav a{
    flex:1 0 64px;
    min-width:64px;
    min-height:68px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    padding:7px 5px 6px;
    color:#dce5f2;
    text-decoration:none;
    text-align:center;
    font-size:11px;
    line-height:1.1;
    border-top:3px solid transparent;
  }
  .mobile-bottom-nav a.active{
    color:#fff;
    background:rgba(255,255,255,.10);
    border-top-color:#4f9cff;
  }
  .mobile-nav-icon{font-size:21px;line-height:1}
  .mobile-nav-label{white-space:nowrap}

  input,select,textarea{font-size:16px;max-width:100%}
  .grid,.grid4{grid-template-columns:1fr}
  .table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
}

@media (max-width:390px){
  .mobile-bottom-nav a{flex-basis:61px;min-width:61px;font-size:10px}
  .mobile-nav-icon{font-size:20px}
}

/* ===== Dashboard com cartões expansíveis ===== */

.dashboard-card-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:14px}
.dashboard-card-toggle{border:0;text-align:left;font:inherit;width:100%}
.stat-button{position:relative;cursor:pointer;user-select:none;transition:transform .16s ease,box-shadow .16s ease;background:#fff;box-shadow:0 2px 12px #0001;min-height:112px;padding-right:52px}
.stat-button:hover{transform:translateY(-2px);box-shadow:0 6px 18px #0002}
.stat-button:focus-visible{outline:3px solid rgba(31,102,209,.3);outline-offset:2px}
.stat-number{font-size:34px;font-weight:bold;display:block}
.stat-label{display:block;color:#667;margin-top:5px}
.collapse-arrow{position:absolute;right:19px;top:50%;transform:translateY(-50%);font-size:25px;color:#687386;transition:transform .18s ease}
.dashboard-card-toggle.is-open .collapse-arrow{transform:translateY(-50%) rotate(180deg)}
.dashboard-card-toggle.is-open{box-shadow:0 0 0 3px rgba(31,102,209,.14),0 6px 18px #0002}
.dashboard-panels{width:100%;margin-bottom:22px}
.dashboard-collapse-content{width:100%;margin:0}
.dashboard-collapse-content[hidden]{display:none!important}
.collapse-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.collapse-heading h2{margin:0}
.empty-state{margin:0;color:#667;padding:10px 0}
.dashboard-actions{clear:both}
@media(max-width:700px){
  .dashboard-card-row{display:flex;overflow-x:auto;gap:10px;padding:2px 2px 8px;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch}
  .dashboard-card-toggle{flex:0 0 145px;min-width:145px;scroll-snap-align:start}
  .stat-button{min-height:82px;padding:17px 44px 17px 16px}
  .stat-number{font-size:29px}
  .dashboard-collapse-content{padding:15px}
  .collapse-heading{align-items:flex-start}
  .collapse-heading h2{font-size:18px}
  .dashboard-actions .btn{margin:3px 0}
}

/* Cores dos cartões de alerta no dashboard */
.dashboard-card-toggle.danger{
  background:#c62828;
  border-left:0;
  color:#fff;
}
.dashboard-card-toggle.danger .stat-number,
.dashboard-card-toggle.danger .stat-label,
.dashboard-card-toggle.danger .collapse-arrow{
  color:#fff;
}
.dashboard-card-toggle.warn{
  background:#ef8c00;
  border-left:0;
  color:#fff;
}
.dashboard-card-toggle.warn .stat-number,
.dashboard-card-toggle.warn .stat-label,
.dashboard-card-toggle.warn .collapse-arrow{
  color:#fff;
}
.dashboard-card-toggle.danger:hover,
.dashboard-card-toggle.warn:hover{
  filter:brightness(.96);
}
.dashboard-card-toggle.danger.is-open{
  box-shadow:0 0 0 3px rgba(198,40,40,.2),0 6px 18px #0002;
}
.dashboard-card-toggle.warn.is-open{
  box-shadow:0 0 0 3px rgba(239,140,0,.23),0 6px 18px #0002;
}


/* Logótipo do ecrã de login: limitado à largura útil do formulário */
.login-card {
  overflow: hidden;
}
.login-logo-wrap {
  width: 100%;
  margin: 0 0 1.25rem;
  text-align: center;
}
.login-logo {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  margin: 0 auto;
}
@media (max-width: 600px) {
  .login-logo { max-height: 135px; }
}


/* Correção definitiva do tamanho do logótipo no login */
.login-page{width:100%;max-width:460px !important;margin:0 auto;padding-left:18px;padding-right:18px}
.login-page .login-card{width:100%;max-width:100%;margin-left:auto;margin-right:auto}
.login-page .login-logo-wrap{width:100%;max-width:100%;overflow:hidden}
.login-page .login-logo{display:block !important;width:100% !important;max-width:100% !important;height:auto !important;max-height:none !important;object-fit:contain !important}
.login-page form,.login-page label,.login-page input{width:100%}


/* Login adaptado à largura real do smartphone */
@media (max-width: 600px) {
  body { margin: 0; }
  .login-page {
    box-sizing: border-box;
    width: 100% !important;
    max-width: none !important;
    min-height: 100vh;
    margin: 0 !important;
    padding: 16px 12px 24px !important;
    display: flex;
    align-items: center;
  }
  .login-page .login-card {
    box-sizing: border-box;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 22px 18px !important;
  }
  .login-page .login-logo-wrap,
  .login-page .login-logo,
  .login-page form,
  .login-page label,
  .login-page input,
  .login-page .btn {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
  }
}


/* Criar empresa: mesmo dimensionamento do login */
.register-page{width:100%;max-width:690px !important;margin:0 auto;padding-left:18px;padding-right:18px}
.register-page .register-card{width:100%;max-width:100%;margin-left:auto;margin-right:auto;overflow:hidden}
.register-page .register-logo-wrap{width:100%;max-width:100%;overflow:hidden;margin:0 0 1.25rem;text-align:center}
.register-page .register-logo{display:block !important;width:100% !important;max-width:100% !important;height:auto !important;max-height:none !important;object-fit:contain !important;margin:0 auto}
.register-page form,.register-page label,.register-page input,.register-page .btn{box-sizing:border-box;width:100%;max-width:100%}
@media (max-width:600px){
  .register-page{box-sizing:border-box;width:100% !important;max-width:none !important;min-height:100vh;margin:0 !important;padding:16px 12px 24px !important;display:flex;align-items:center}
  .register-page .register-card{box-sizing:border-box;width:100% !important;max-width:none !important;margin:0 !important;padding:22px 18px !important}
  .register-page .register-logo-wrap,.register-page .register-logo,.register-page form,.register-page label,.register-page input,.register-page .btn{box-sizing:border-box;width:100% !important;max-width:100% !important}
}

.register-page .register-back-login{display:block;width:100%;margin-top:10px;text-align:center}


/* Botões do formulário Criar empresa na mesma linha */
.register-page .register-actions{display:flex;gap:10px;align-items:stretch;width:100%;margin-top:4px}
.register-page .register-actions .btn{display:flex;align-items:center;justify-content:center;flex:1 1 0;width:auto !important;max-width:none !important;margin:0;text-align:center;white-space:nowrap}
.register-page .register-back-login{margin-top:0}
@media (max-width:380px){
  .register-page .register-actions{gap:8px}
  .register-page .register-actions .btn{padding-left:8px;padding-right:8px;font-size:14px}
}

/* Recuperação da palavra-passe */
.login-links{display:flex;justify-content:space-between;gap:14px;align-items:center;margin-top:14px;flex-wrap:wrap}
.password-actions{display:flex;gap:10px;align-items:stretch;width:100%;margin-top:6px}
.password-actions .btn{display:flex;flex:1 1 0;align-items:center;justify-content:center;width:auto !important;margin:0;text-align:center}
.password-help{font-size:13px;color:#5f6b76;margin-top:-4px}
@media(max-width:420px){.login-links{justify-content:center;text-align:center}.password-actions{gap:8px}.password-actions .btn{padding-left:8px;padding-right:8px;font-size:14px}}

/* Botões visíveis no menu de login */
.login-menu-actions{
  display:flex;
  gap:10px;
  width:100%;
  margin-top:12px;
  align-items:stretch;
}
.login-menu-actions .btn{
  display:flex;
  flex:1 1 0;
  width:auto !important;
  min-height:44px;
  align-items:center;
  justify-content:center;
  margin:0;
  padding:10px 12px;
  text-align:center;
  line-height:1.2;
  text-decoration:none;
}
@media(max-width:420px){
  .login-menu-actions{gap:8px}
  .login-menu-actions .btn{font-size:13px;padding:10px 6px}
}

/* Período experimental e subscrições */
.trial-banner{margin:0 0 16px;padding:11px 14px;border-radius:9px;background:#fff3cd;color:#664d03;border:1px solid #ffecb5}.trial-banner a{font-weight:700}.billing-page{max-width:1100px;margin:0 auto;padding:30px 18px}.billing-top{text-align:center;margin-bottom:24px}.billing-alert,.billing-info{padding:13px;border-radius:9px;margin:12px auto;max-width:760px}.billing-alert{background:#f8d7da;color:#842029}.billing-info{background:#cff4fc;color:#055160}.pricing-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}.pricing-card{background:#fff;border:1px solid #dde3ea;border-radius:14px;padding:24px;box-shadow:0 4px 18px #0000000d;display:flex;flex-direction:column}.pricing-card.current{border:2px solid #1f66d1}.pricing-card h2{margin-top:0}.pricing-card ul{padding-left:20px;min-height:110px;flex:1}.price strong{font-size:32px}.price span{color:#687386}.pricing-card form,.pricing-card .btn{width:100%}.disabled{pointer-events:none;opacity:.7}.billing-return{text-align:center;margin-top:24px}.billing-result{text-align:center;margin-top:12vh}@media(max-width:760px){.pricing-grid{grid-template-columns:1fr}.billing-page{padding:18px 12px}.pricing-card ul{min-height:0}}


/* Login: Entrar e Criar empresa na mesma linha; recuperação como texto */
.login-primary-actions{display:flex;gap:10px;align-items:stretch;width:100%;margin-top:30px !important}
.login-primary-actions .btn{display:flex;flex:1 1 0;width:auto !important;max-width:none !important;min-height:44px;align-items:center;justify-content:center;margin:0;text-align:center;white-space:nowrap;text-decoration:none}
.login-recovery-link{width:100%;margin-top:12px;text-align:center}
.login-recovery-link a{display:inline-block;color:#1f66d1;font-size:14px;font-weight:600;text-decoration:none}
.login-recovery-link a:hover,.login-recovery-link a:focus{text-decoration:underline}
@media(max-width:380px){.login-primary-actions{gap:8px}.login-primary-actions .btn{padding-left:7px;padding-right:7px;font-size:13px}}


/* Login: botões com a mesma altura, Entrar à esquerda e Criar empresa à direita */
.login-primary-actions{
  display:flex !important;
  width:100% !important;
  align-items:stretch !important;
  justify-content:space-between !important;
  gap:12px !important;
}
.login-primary-actions .btn{
  box-sizing:border-box !important;
  display:inline-flex !important;
  flex:0 0 auto !important;
  width:auto !important;
  max-width:none !important;
  height:44px !important;
  min-height:44px !important;
  max-height:44px !important;
  margin:0 !important;
  padding:0 18px !important;
  align-items:center !important;
  justify-content:center !important;
  line-height:1 !important;
  white-space:nowrap !important;
}
.login-primary-actions .btn:first-child{
  margin-right:auto !important;
}
.login-primary-actions .btn:last-child{
  margin-left:auto !important;
}
@media(max-width:380px){
  .login-primary-actions{gap:8px !important;}
  .login-primary-actions .btn{
    height:42px !important;
    min-height:42px !important;
    max-height:42px !important;
    padding:0 11px !important;
    font-size:13px !important;
  }
}

/* Trabalhadores e entidades: destinatários de email compactos e alinhados */
.entity-email-options{
  min-width:0 !important;
  margin:0 !important;
  padding:10px 14px 13px !important;
  border:1px solid #cbd5e1 !important;
  border-radius:10px !important;
  background:#fff !important;
  box-shadow:0 4px 14px rgba(23,32,51,.12) !important;
}
.entity-email-options .entity-email-legend,
.entity-email-options legend{
  display:inline-flex !important;
  flex-direction:row !important;
  align-items:center !important;
  gap:7px !important;
  width:auto !important;
  padding:0 7px !important;
  margin:0 !important;
  font-size:1rem !important;
  font-weight:500 !important;
  line-height:1.2 !important;
}
.entity-email-options-row{
  display:flex !important;
  flex-direction:row !important;
  align-items:center !important;
  justify-content:flex-start !important;
  flex-wrap:nowrap !important;
  gap:28px !important;
  min-height:34px !important;
  padding:4px 7px 0 !important;
}
.entity-email-options .checkbox-inline{
  display:inline-flex !important;
  flex-direction:row !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:8px !important;
  width:auto !important;
  max-width:none !important;
  margin:0 !important;
  padding:0 !important;
  cursor:pointer !important;
  font-weight:700 !important;
  white-space:nowrap !important;
}
.entity-email-options .checkbox-inline input[type="checkbox"]{
  display:inline-block !important;
  appearance:auto !important;
  -webkit-appearance:checkbox !important;
  flex:0 0 18px !important;
  width:18px !important;
  min-width:18px !important;
  max-width:18px !important;
  height:18px !important;
  min-height:18px !important;
  max-height:18px !important;
  margin:0 !important;
  padding:0 !important;
  vertical-align:middle !important;
}
.entity-email-options .checkbox-inline span{
  display:inline-block !important;
  margin:0 !important;
  line-height:18px !important;
}
.entity-email-info{
  position:relative !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  width:20px !important;
  height:20px !important;
  color:#29487d !important;
  cursor:help !important;
  font-size:18px !important;
  line-height:1 !important;
}
.entity-email-tooltip{
  position:absolute !important;
  left:50% !important;
  bottom:calc(100% + 9px) !important;
  transform:translateX(-50%) !important;
  z-index:1000 !important;
  width:270px !important;
  max-width:calc(100vw - 36px) !important;
  padding:8px 10px !important;
  border-radius:6px !important;
  background:#1f2937 !important;
  color:#fff !important;
  font-size:.82rem !important;
  font-weight:400 !important;
  line-height:1.35 !important;
  white-space:normal !important;
  box-shadow:0 4px 12px rgba(0,0,0,.22) !important;
  opacity:0 !important;
  visibility:hidden !important;
  pointer-events:none !important;
}
.entity-email-tooltip::after{
  content:"" !important;
  position:absolute !important;
  top:100% !important;
  left:50% !important;
  transform:translateX(-50%) !important;
  border:6px solid transparent !important;
  border-top-color:#1f2937 !important;
}
.entity-email-info:hover .entity-email-tooltip{
  opacity:1 !important;
  visibility:visible !important;
}
@media(max-width:420px){
  .entity-email-options-row{gap:20px !important;}
  .entity-email-options{padding-left:10px !important;padding-right:10px !important;}
  .entity-email-tooltip{
    left:auto !important;
    right:-8px !important;
    transform:none !important;
    width:240px !important;
  }
  .entity-email-tooltip::after{
    left:auto !important;
    right:10px !important;
    transform:none !important;
  }
}

/* RGPD Portugal — páginas legais, centro de privacidade e avisos */
.legal-footer{
  display:flex;align-items:center;justify-content:center;gap:14px;flex-wrap:wrap;
  width:100%;padding:18px 14px;margin-top:22px;border-top:1px solid #dfe5ec;
  color:#64748b;font-size:13px;background:transparent
}
.legal-footer a{color:#29487d;text-decoration:none;font-weight:600}
.legal-footer a:hover,.legal-footer a:focus{text-decoration:underline}
.legal-page-body{background:#f4f6f9;color:#172033}
.legal-page{width:min(980px,100%);margin:0 auto;padding:24px 16px 38px}
.legal-page-brand{text-align:center;margin-bottom:18px}
.legal-page-brand img{display:inline-block;width:min(260px,80vw);height:auto;max-height:105px;object-fit:contain}
.legal-document{line-height:1.65;padding:30px}
.legal-document h1{margin-top:0;color:#172033}
.legal-document h2{margin-top:28px;color:#1e3a5f;font-size:1.25rem}
.legal-document ul{padding-left:22px}
.legal-version{font-size:13px;color:#64748b}
.legal-alert{padding:13px 15px;margin:14px 0;border:1px solid #c8d8ed;border-left:5px solid #29487d;border-radius:8px;background:#f5f9ff;color:#22334d}
.legal-table{width:100%;border-collapse:collapse;margin:12px 0}
.legal-table th,.legal-table td{padding:10px;border:1px solid #d8dee8;text-align:left;vertical-align:top}
.legal-table th{background:#f1f5f9}
.privacy-ack{display:flex!important;flex-direction:row!important;align-items:flex-start!important;gap:9px!important;width:100%;font-weight:500!important;line-height:1.45}
.privacy-ack input[type="checkbox"]{flex:0 0 18px;width:18px!important;height:18px!important;margin-top:2px!important}
.privacy-ack span{display:block;min-width:0}
.form-help{font-size:13px;color:#64748b;line-height:1.45}
.muted{color:#7b8794}

.rgpd-page{max-width:1280px;margin:0 auto}
.rgpd-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:16px}
.rgpd-heading h1{margin:0 0 5px}.rgpd-heading p{margin:0;color:#64748b}
.rgpd-disclaimer{margin-bottom:16px}
.rgpd-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 18px}
.rgpd-tabs a{display:inline-flex;padding:8px 11px;border:1px solid #ccd7e4;border-radius:8px;background:#fff;color:#29487d;text-decoration:none;font-weight:700;font-size:14px}
.rgpd-tabs a:hover,.rgpd-tabs a:focus{background:#eef5ff}
.rgpd-page section[id]{scroll-margin-top:20px}
.rgpd-page .span-2{grid-column:1/-1}
.rgpd-action-grid{display:flex;flex-wrap:wrap;gap:10px;align-items:stretch}
.rgpd-action-grid .btn{margin:0;width:auto}
.rgpd-details{margin:10px 0 18px;border:1px solid #d8dee8;border-radius:9px;padding:10px 13px;background:#f8fafc}
.rgpd-details summary{cursor:pointer;font-weight:700;color:#29487d}
.rgpd-details[open] summary{margin-bottom:14px}
.rgpd-inline-form{display:grid;grid-template-columns:minmax(130px,1fr);gap:6px;min-width:230px}
.rgpd-inline-form input,.rgpd-inline-form select{width:100%;min-width:0}
.rgpd-inline-form .btn{width:auto;justify-self:start;margin:0}
.rgpd-overdue td{background:#fff1f2!important;color:#7f1d1d}
.rgpd-entity-actions{display:flex!important;align-items:flex-start!important;gap:6px!important;flex-wrap:wrap!important;min-width:260px}
.rgpd-entity-actions form{display:inline-flex;margin:0}
.rgpd-entity-actions .btn{margin:0}
.danger-details{display:inline-block;border:1px solid #efb7b7;border-radius:6px;padding:4px 7px;background:#fff7f7}
.danger-details summary{cursor:pointer;color:#9f1d1d;font-weight:700}
.danger-details form{display:grid!important;gap:6px;margin-top:7px!important;min-width:210px}
.compact-check{display:flex!important;flex-direction:row!important;align-items:center!important;gap:6px!important;font-size:12px!important;font-weight:500!important}
.compact-check input{width:16px!important;height:16px!important;margin:0!important}
.privacy-notice-fieldset{display:grid;grid-template-columns:minmax(0,1fr) minmax(120px,.7fr);gap:8px 12px;align-items:end;padding:10px 12px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;box-shadow:0 4px 14px rgba(23,32,51,.12)}
.privacy-notice-fieldset legend{font-weight:700;color:#29487d;padding:0 5px}
.privacy-notice-fieldset .checkbox-inline{display:flex!important;align-items:center!important;gap:8px!important;flex-direction:row!important;margin:0!important}
.privacy-notice-fieldset .checkbox-inline input{width:18px!important;height:18px!important;flex:0 0 18px!important}
.privacy-notice-fieldset .btn{justify-self:start;margin:0}
.document-legal-hold{display:flex!important;flex-direction:row!important;align-items:center!important;gap:8px!important;padding-top:26px}
.document-legal-hold input{width:18px!important;height:18px!important;flex:0 0 18px!important}
.privacy-notice-print .print-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;margin-bottom:14px}

@media(max-width:760px){
  .legal-document{padding:19px 15px}.legal-page{padding:14px 10px 26px}.legal-table{display:block;overflow-x:auto}
  .rgpd-heading{flex-direction:column}.rgpd-heading .btn{width:100%}
  .rgpd-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.rgpd-tabs a{justify-content:center;text-align:center}
  .rgpd-page .grid{grid-template-columns:minmax(0,1fr)!important}.rgpd-page .span-2{grid-column:auto}
  .rgpd-action-grid{display:grid;grid-template-columns:minmax(0,1fr)}.rgpd-action-grid .btn{width:100%}
  .rgpd-entity-actions{min-width:220px}
  .privacy-notice-fieldset{grid-template-columns:minmax(0,1fr)}
  .document-legal-hold{padding-top:0}
}
@media print{
  .desktop-header,.mobile-bottom-nav,.trial-banner,.legal-footer,.print-actions{display:none!important}
  body,.legal-page-body{background:#fff!important}.legal-page{width:100%;padding:0}.legal-document{box-shadow:none!important;border:0!important;padding:0!important}
}

/* A minha subscrição: manter os botões de gestão na mesma linha */
.subscription-actions{
  display:flex;
  align-items:stretch;
  gap:10px;
  flex-wrap:nowrap;
  margin-top:18px;
}
.subscription-actions>a,
.subscription-actions>form{
  display:flex;
  margin:0;
}
.subscription-actions>.btn,
.subscription-actions>form>.btn{
  display:flex;
  align-items:center;
  justify-content:center;
  margin:0;
  text-align:center;
}
@media(max-width:520px){
  .subscription-actions{gap:8px}
  .subscription-actions>a,
  .subscription-actions>form{
    flex:1 1 0;
    min-width:0;
  }
  .subscription-actions .btn{
    width:100%;
    min-height:44px;
    padding:10px 8px;
    font-size:13px;
    line-height:1.2;
    white-space:normal;
  }
}

/* Criar empresa: pesquisa automática da localidade pelo código postal */
.register-page .postal-lookup-status{
  display:block;
  min-height:18px;
  margin-top:6px;
  color:#667085;
  font-size:12px;
  line-height:1.35;
}
.register-page .postal-lookup-status.is-loading{color:#1f66d1}
.register-page .postal-lookup-status.is-success{color:#157347;font-weight:600}
.register-page .postal-lookup-status.is-error{color:#b42318;font-weight:600}

/* Criar empresa: Código postal compacto e Localidade na mesma linha */
.register-page .company-postal-row{
  display:grid !important;
  grid-template-columns:max-content minmax(0,1fr) !important;
  column-gap:12px !important;
  align-items:start !important;
  width:100% !important;
  max-width:100% !important;
}
.register-page .company-postal-row > label{
  display:flex !important;
  flex-direction:column !important;
  align-items:stretch !important;
  gap:6px !important;
  width:auto !important;
  max-width:none !important;
  min-width:0 !important;
  margin:0 !important;
}
.register-page .company-postcode-field{
  width:118px !important;
  min-width:118px !important;
  max-width:118px !important;
}
.register-page .company-postcode-field > input{
  width:118px !important;
  min-width:118px !important;
  max-width:118px !important;
}
.register-page .company-locality-field{
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
}
.register-page .company-locality-field > input{
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
}
@media (max-width:380px){
  .register-page .company-postal-row{
    grid-template-columns:106px minmax(0,1fr) !important;
    column-gap:8px !important;
  }
  .register-page .company-postcode-field,
  .register-page .company-postcode-field > input{
    width:106px !important;
    min-width:106px !important;
    max-width:106px !important;
  }
}

/* Criar empresa: NIF compacto e Morada na mesma linha */
.register-page .company-address-row{
  display:grid !important;
  grid-template-columns:132px minmax(0,1fr) !important;
  column-gap:12px !important;
  align-items:start !important;
  width:100% !important;
  max-width:100% !important;
}
.register-page .company-address-row > label{
  display:flex !important;
  flex-direction:column !important;
  align-items:stretch !important;
  gap:6px !important;
  width:auto !important;
  max-width:none !important;
  min-width:0 !important;
  margin:0 !important;
}
.register-page .company-nif-field,
.register-page .company-nif-field > input{
  width:132px !important;
  min-width:132px !important;
  max-width:132px !important;
}
.register-page .company-address-field,
.register-page .company-address-field > input{
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
}
@media (max-width:380px){
  .register-page .company-address-row{
    grid-template-columns:118px minmax(0,1fr) !important;
    column-gap:8px !important;
  }
  .register-page .company-nif-field,
  .register-page .company-nif-field > input{
    width:118px !important;
    min-width:118px !important;
    max-width:118px !important;
  }
}


/* Criar empresa: garantia final de NIF e Morada na mesma linha */
.register-page .company-address-row{
  display:flex !important;
  flex-direction:row !important;
  flex-wrap:nowrap !important;
  gap:12px !important;
  align-items:flex-start !important;
  width:100% !important;
  max-width:100% !important;
}
.register-page .company-address-row > label{
  display:flex !important;
  flex-direction:column !important;
  gap:6px !important;
  margin:0 !important;
  min-width:0 !important;
}
.register-page .company-address-row .company-nif-field{
  flex:0 0 132px !important;
  width:132px !important;
  min-width:132px !important;
  max-width:132px !important;
}
.register-page .company-address-row .company-address-field{
  flex:1 1 auto !important;
  width:auto !important;
  min-width:0 !important;
  max-width:none !important;
}
.register-page .company-address-row input{
  box-sizing:border-box !important;
  width:100% !important;
  max-width:100% !important;
}
@media (max-width:380px){
  .register-page .company-address-row{gap:8px !important;}
  .register-page .company-address-row .company-nif-field{
    flex-basis:118px !important;
    width:118px !important;
    min-width:118px !important;
    max-width:118px !important;
  }
}

/* Criar empresa: Administrador e Email na mesma linha */
.register-page .company-admin-row{
  display:flex !important;
  flex-direction:row !important;
  flex-wrap:nowrap !important;
  gap:12px !important;
  align-items:flex-start !important;
  width:100% !important;
  max-width:100% !important;
}
.register-page .company-admin-row > label{
  display:flex !important;
  flex-direction:column !important;
  gap:6px !important;
  margin:0 !important;
  min-width:0 !important;
  max-width:none !important;
}
.register-page .company-admin-row .company-admin-field{
  flex:0 1 42% !important;
  width:auto !important;
}
.register-page .company-admin-row .company-email-field{
  flex:1 1 58% !important;
  width:auto !important;
}
.register-page .company-admin-row input{
  box-sizing:border-box !important;
  width:100% !important;
  max-width:100% !important;
}
@media (max-width:380px){
  .register-page .company-admin-row{gap:8px !important;}
  .register-page .company-admin-row .company-admin-field{flex-basis:40% !important;}
  .register-page .company-admin-row .company-email-field{flex-basis:60% !important;}
}

/* ===== Login: largura total e leitura confortável no smartphone ===== */
body.login-body{
  margin:0;
  min-height:100vh;
  min-height:100dvh;
  background:#f4f6f9;
}

main.login-page{
  box-sizing:border-box;
  width:100% !important;
  max-width:520px !important;
  min-height:100vh;
  min-height:100dvh;
  margin:0 auto !important;
  padding:32px 20px calc(28px + env(safe-area-inset-bottom)) !important;
  display:flex !important;
  flex-direction:column !important;
  align-items:stretch !important;
  justify-content:center !important;
}

.login-page .login-card{
  box-sizing:border-box;
  width:100% !important;
  max-width:none !important;
  margin:0 !important;
  padding:28px !important;
  overflow:visible;
}

.login-page .login-logo-wrap{
  width:100% !important;
  margin:0 0 22px !important;
  text-align:center;
}

.login-page .login-logo{
  display:block !important;
  width:min(300px,100%) !important;
  max-width:100% !important;
  height:auto !important;
  margin:0 auto !important;
  object-fit:contain !important;
}

.login-page form,
.login-page label,
.login-page input{
  box-sizing:border-box;
  width:100% !important;
  max-width:100% !important;
}

.login-page label{
  gap:8px;
  margin-bottom:17px;
  font-size:16px;
}

.login-page input{
  min-height:50px;
  padding:12px 14px;
  font-size:16px;
  line-height:1.25;
}

.login-page .login-primary-actions{
  display:grid !important;
  grid-template-columns:1fr 1.35fr;
  gap:12px !important;
  width:100% !important;
  margin-top:22px !important;
}

.login-page .login-primary-actions .btn,
.login-page .login-primary-actions .btn:first-child,
.login-page .login-primary-actions .btn:last-child{
  box-sizing:border-box !important;
  display:flex !important;
  width:100% !important;
  min-width:0 !important;
  max-width:none !important;
  height:50px !important;
  min-height:50px !important;
  max-height:none !important;
  margin:0 !important;
  padding:0 14px !important;
  align-items:center !important;
  justify-content:center !important;
  font-size:15px !important;
  line-height:1.2 !important;
  white-space:normal !important;
  text-align:center;
}

.login-page .login-recovery-link{
  margin-top:17px;
}

.login-page .login-recovery-link a{
  font-size:15px;
  line-height:1.4;
}

.login-page .legal-footer{
  flex:0 0 auto;
  width:100% !important;
  margin:24px 0 0 !important;
  padding:18px 8px 0 !important;
}

@media (max-width:700px){
  body.login-body{
    padding-bottom:0 !important;
  }

  main.login-page{
    width:100% !important;
    max-width:none !important;
    min-height:100vh;
    min-height:100dvh;
    margin:0 !important;
    padding:12px 10px calc(22px + env(safe-area-inset-bottom)) !important;
    align-items:stretch !important;
    justify-content:flex-start !important;
  }

  .login-page .login-card{
    width:100% !important;
    max-width:none !important;
    margin:0 !important;
    padding:24px 20px !important;
    border-radius:13px;
  }

  .login-page .login-logo-wrap{
    margin-bottom:20px !important;
  }

  .login-page .login-logo{
    width:min(280px,100%) !important;
  }

  .login-page .legal-footer{
    position:static !important;
    display:flex !important;
    flex:0 0 auto !important;
    flex-direction:column !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:8px !important;
    flex-wrap:nowrap !important;
    clear:both !important;
    width:100% !important;
    max-width:100% !important;
    margin:18px 0 0 !important;
    padding:16px 8px 0 !important;
    text-align:center !important;
  }

  .login-page .legal-footer span,
  .login-page .legal-footer a{
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    margin:0 !important;
    text-align:center !important;
    white-space:normal !important;
  }
}

@media (max-width:380px){
  .login-page .login-card{
    padding:22px 18px !important;
  }

  .login-page .login-primary-actions{
    grid-template-columns:1fr !important;
    gap:10px !important;
  }

  .login-page .login-primary-actions .btn{
    font-size:15px !important;
  }
}


/* Criar empresa: links legais por baixo no smartphone */
@media (max-width:700px){
  main.register-page{
    display:flex !important;
    flex-direction:column !important;
    align-items:stretch !important;
    justify-content:flex-start !important;
  }
  .register-page .register-card{
    flex:0 0 auto !important;
    width:100% !important;
  }
  .register-page .legal-footer{
    position:static !important;
    display:flex !important;
    flex:0 0 auto !important;
    flex-direction:column !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:8px !important;
    flex-wrap:nowrap !important;
    clear:both !important;
    width:100% !important;
    max-width:100% !important;
    margin:18px 0 0 !important;
    padding:16px 8px 0 !important;
    text-align:center !important;
  }
  .register-page .legal-footer span,
  .register-page .legal-footer a{
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    margin:0 !important;
    text-align:center !important;
    white-space:normal !important;
  }
}


/* Login: botão Criar empresa a verde */
.login-primary-actions .login-create-company{
  background:#198754 !important;
  color:#fff !important;
}
.login-primary-actions .login-create-company:hover,
.login-primary-actions .login-create-company:focus{
  background:#157347 !important;
}

/* Seletor de idioma PT/EN/ES/FR/DE */
.language-switcher{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  padding:4px;
  border:1px solid #d8e0ea;
  border-radius:999px;
  background:#fff;
  box-shadow:0 2px 8px rgba(15,23,42,.08);
}
.language-option{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:31px;
  height:27px;
  padding:0 7px;
  border-radius:999px;
  color:#334155;
  font-size:11px;
  font-weight:800;
  line-height:1;
  text-decoration:none;
  letter-spacing:.02em;
}
.language-option:hover,
.language-option:focus{
  background:#eaf2ff;
  color:#174a87;
  text-decoration:none;
}
.language-option.active{
  background:#174a87;
  color:#fff;
}
.header-language-switcher{
  margin-left:auto;
  flex:0 0 auto;
}
.standalone-language-switcher{
  float:right;
  margin:-4px -2px 10px 12px;
}
.legal-language-switcher{
  margin-left:auto;
}
.legal-page-brand{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
@media(max-width:900px){
  .desktop-header{
    flex-wrap:wrap;
  }
  .header-brand{
    width:100%;
  }
  .header-language-switcher{
    margin-left:auto;
  }
}
@media(max-width:520px){
  .language-option{
    min-width:27px;
    height:25px;
    padding:0 5px;
    font-size:10px;
  }
  .standalone-language-switcher{
    float:none;
    display:flex;
    width:max-content;
    margin:0 auto 12px;
  }
  .legal-page-brand{
    align-items:flex-start;
  }
}

/* ===== Ajuda e manual do utilizador ===== */
.help-page{max-width:1180px;margin:0 auto}
.help-hero{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:28px}
.help-hero h1{margin:4px 0 9px;font-size:clamp(30px,4vw,44px)}
.help-hero p{margin:0;max-width:760px;color:#526079;font-size:17px;line-height:1.55}
.help-kicker{display:inline-block;color:#1f66d1;font-size:12px;font-weight:900;letter-spacing:.15em}
.help-hero-actions{flex:0 0 auto}
.help-start h2,.help-toolbar h2{margin-top:0}
.help-start ol{margin:0;padding-left:24px;line-height:1.75;color:#334155}
.help-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:12px 18px}
.help-search-label{min-width:0}
.help-search-label input{width:100%}
.help-toolbar-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.help-results{grid-column:1/-1;margin:0;color:#667;font-size:14px}
.help-topic-nav{display:flex;gap:8px;overflow-x:auto;padding:2px 2px 14px;margin-bottom:8px;scrollbar-width:thin}
.help-topic-nav a{display:inline-flex;align-items:center;gap:7px;flex:0 0 auto;padding:9px 12px;border:1px solid #d5deea;border-radius:999px;background:#fff;color:#25324a;text-decoration:none;font-weight:700;box-shadow:0 2px 7px #0000000d}
.help-topic-nav a:hover,.help-topic-nav a:focus{border-color:#1f66d1;color:#1f66d1;outline:none}
.help-topic-nav a span{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;background:#eaf2ff;color:#1f66d1;font-size:12px}
.help-topics{display:grid;gap:14px}
.help-topic{padding:0;margin-bottom:0;overflow:hidden;scroll-margin-top:18px}
.help-topic[hidden]{display:none!important}
.help-topic>summary{display:flex;align-items:center;gap:14px;padding:18px 20px;cursor:pointer;list-style:none;user-select:none}
.help-topic>summary::-webkit-details-marker{display:none}
.help-topic>summary:hover{background:#f8fbff}
.help-topic[open]>summary{background:#f1f6ff;border-bottom:1px solid #dce7f5}
.help-topic-number{display:inline-flex;align-items:center;justify-content:center;flex:0 0 38px;width:38px;height:38px;border-radius:10px;background:#1f66d1;color:#fff;font-weight:900}
.help-topic-heading{display:flex;flex-direction:column;gap:3px;min-width:0}
.help-topic-heading strong{font-size:20px;color:#172033}
.help-topic-heading small{font-size:14px;line-height:1.35;color:#667}
.help-topic-arrow{margin-left:auto;font-size:25px;color:#60708a;transition:transform .18s ease}
.help-topic[open] .help-topic-arrow{transform:rotate(180deg)}
.help-topic-content{padding:22px 24px 25px}
.help-topic-content h3{margin:24px 0 10px;font-size:18px;color:#172033}
.help-topic-content h3:first-of-type{margin-top:18px}
.help-topic-intro{margin:0;color:#334155;line-height:1.65;font-size:16px}
.help-field-list{display:grid;grid-template-columns:minmax(180px,.38fr) minmax(0,1fr);margin:0;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden}
.help-field-list dt,.help-field-list dd{margin:0;padding:12px 14px;border-bottom:1px solid #e7ebf0;line-height:1.5}
.help-field-list dt{background:#f8fafc;font-weight:800;color:#27364f}
.help-field-list dd{color:#445169}
.help-field-list dt:last-of-type,.help-field-list dd:last-of-type{border-bottom:0}
.help-topic-content ul{margin:0;padding-left:22px;color:#3d4a61;line-height:1.65}
.help-tip-box{margin-top:22px;padding:16px 18px;border-left:5px solid #1f66d1;border-radius:9px;background:#f1f6ff}
.help-tip-box h3{margin:0 0 8px}
.help-topic-actions{display:flex;justify-content:flex-end;margin-top:22px}
.help-access-note{margin:20px 0 0;padding:12px 14px;border-radius:8px;background:#fff5d9;color:#6d4c00;font-weight:700}
.help-empty{text-align:center}
.help-empty h2{margin-top:0}
@media(max-width:760px){
  .help-hero{align-items:flex-start;flex-direction:column;padding:22px}
  .help-hero-actions,.help-hero-actions .btn{width:100%;text-align:center}
  .help-toolbar{grid-template-columns:1fr}
  .help-toolbar-actions{align-items:stretch}
  .help-toolbar-actions .btn{flex:1}
  .help-results{grid-column:auto}
  .help-topic>summary{padding:15px 14px;gap:11px}
  .help-topic-number{width:34px;height:34px;flex-basis:34px}
  .help-topic-heading strong{font-size:18px}
  .help-topic-heading small{font-size:13px}
  .help-topic-content{padding:18px 14px 20px}
  .help-field-list{grid-template-columns:1fr}
  .help-field-list dt,.help-field-list dd{border-bottom:1px solid #e7ebf0}
  .help-field-list dd{padding-top:8px}
  .help-field-list dt{padding-bottom:8px}
  .help-field-list dd:last-of-type{border-bottom:0}
  .help-topic-actions .btn{width:100%;text-align:center}
}

/* Ajuste do menu após inclusão da Ajuda */
@media (min-width:821px) and (max-width:1250px){
  .desktop-header{gap:10px;padding-left:1.5%;padding-right:1.5%}
  .header-brand{gap:9px}
  .header-logo{max-width:145px;height:40px}
  .header-company{max-width:135px;font-size:12px}
  .desktop-nav{gap:2px}
  .desktop-nav a{padding:8px 6px;font-size:12px}
  .header-language-switcher .language-option{min-width:29px;padding:7px 6px}
}

/* Acesso público à ajuda a partir do login e do registo */
.login-help-link,.register-help-link{width:100%;margin-top:8px;text-align:center}
.login-help-link a,.register-help-link a{display:inline-block;color:#1f66d1;font-size:14px;font-weight:700;text-decoration:none}
.login-help-link a:hover,.login-help-link a:focus,.register-help-link a:hover,.register-help-link a:focus{text-decoration:underline}
.help-public-header{background:#172033;color:#fff;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 3%;min-height:68px}
.help-public-brand{display:inline-flex;align-items:center;color:#fff;text-decoration:none}
.help-public-brand img{display:block;width:auto;height:46px;max-width:190px;object-fit:contain}
.help-standalone-body main{padding:28px 3%;max-width:1400px;margin:auto}
.help-hero-actions{display:flex;align-items:center;justify-content:flex-end;gap:9px;flex-wrap:wrap}
@media(max-width:760px){
  .help-public-header{min-height:58px;padding:7px 12px}
  .help-public-brand img{height:40px;max-width:160px}
  .help-standalone-body main{padding:16px 12px 24px}
  .help-hero-actions{width:100%;align-items:stretch;flex-direction:column}
}
.help-language-note{margin-top:9px!important;padding:8px 10px;border-radius:7px;background:#fff5d9;color:#6d4c00!important;font-size:13px!important;font-weight:700}
